3 #define PY_SSIZE_T_CLEAN 6 #error Python headers needed to compile C extensions, please install development version of Python. 7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) 8 #error Cython requires Python 2.6+ or Python 3.3+. 10 #define CYTHON_ABI "0_29_16" 11 #define CYTHON_HEX_VERSION 0x001D10F0 12 #define CYTHON_FUTURE_DIVISION 0 15 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) 17 #if !defined(WIN32) && !defined(MS_WINDOWS) 29 #define DL_IMPORT(t) t 32 #define DL_EXPORT(t) t 35 #ifndef HAVE_LONG_LONG 36 #if PY_VERSION_HEX >= 0x02070000 37 #define HAVE_LONG_LONG 41 #define PY_LONG_LONG LONG_LONG 44 #define Py_HUGE_VAL HUGE_VAL 47 #define CYTHON_COMPILING_IN_PYPY 1 48 #define CYTHON_COMPILING_IN_PYSTON 0 49 #define CYTHON_COMPILING_IN_CPYTHON 0 50 #undef CYTHON_USE_TYPE_SLOTS 51 #define CYTHON_USE_TYPE_SLOTS 0 52 #undef CYTHON_USE_PYTYPE_LOOKUP 53 #define CYTHON_USE_PYTYPE_LOOKUP 0 54 #if PY_VERSION_HEX < 0x03050000 55 #undef CYTHON_USE_ASYNC_SLOTS 56 #define CYTHON_USE_ASYNC_SLOTS 0 57 #elif !defined(CYTHON_USE_ASYNC_SLOTS) 58 #define CYTHON_USE_ASYNC_SLOTS 1 60 #undef CYTHON_USE_PYLIST_INTERNALS 61 #define CYTHON_USE_PYLIST_INTERNALS 0 62 #undef CYTHON_USE_UNICODE_INTERNALS 63 #define CYTHON_USE_UNICODE_INTERNALS 0 64 #undef CYTHON_USE_UNICODE_WRITER 65 #define CYTHON_USE_UNICODE_WRITER 0 66 #undef CYTHON_USE_PYLONG_INTERNALS 67 #define CYTHON_USE_PYLONG_INTERNALS 0 68 #undef CYTHON_AVOID_BORROWED_REFS 69 #define CYTHON_AVOID_BORROWED_REFS 1 70 #undef CYTHON_ASSUME_SAFE_MACROS 71 #define CYTHON_ASSUME_SAFE_MACROS 0 72 #undef CYTHON_UNPACK_METHODS 73 #define CYTHON_UNPACK_METHODS 0 74 #undef CYTHON_FAST_THREAD_STATE 75 #define CYTHON_FAST_THREAD_STATE 0 76 #undef CYTHON_FAST_PYCALL 77 #define CYTHON_FAST_PYCALL 0 78 #undef CYTHON_PEP489_MULTI_PHASE_INIT 79 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 80 #undef CYTHON_USE_TP_FINALIZE 81 #define CYTHON_USE_TP_FINALIZE 0 82 #undef CYTHON_USE_DICT_VERSIONS 83 #define CYTHON_USE_DICT_VERSIONS 0 84 #undef CYTHON_USE_EXC_INFO_STACK 85 #define CYTHON_USE_EXC_INFO_STACK 0 86 #elif defined(PYSTON_VERSION) 87 #define CYTHON_COMPILING_IN_PYPY 0 88 #define CYTHON_COMPILING_IN_PYSTON 1 89 #define CYTHON_COMPILING_IN_CPYTHON 0 90 #ifndef CYTHON_USE_TYPE_SLOTS 91 #define CYTHON_USE_TYPE_SLOTS 1 93 #undef CYTHON_USE_PYTYPE_LOOKUP 94 #define CYTHON_USE_PYTYPE_LOOKUP 0 95 #undef CYTHON_USE_ASYNC_SLOTS 96 #define CYTHON_USE_ASYNC_SLOTS 0 97 #undef CYTHON_USE_PYLIST_INTERNALS 98 #define CYTHON_USE_PYLIST_INTERNALS 0 99 #ifndef CYTHON_USE_UNICODE_INTERNALS 100 #define CYTHON_USE_UNICODE_INTERNALS 1 102 #undef CYTHON_USE_UNICODE_WRITER 103 #define CYTHON_USE_UNICODE_WRITER 0 104 #undef CYTHON_USE_PYLONG_INTERNALS 105 #define CYTHON_USE_PYLONG_INTERNALS 0 106 #ifndef CYTHON_AVOID_BORROWED_REFS 107 #define CYTHON_AVOID_BORROWED_REFS 0 109 #ifndef CYTHON_ASSUME_SAFE_MACROS 110 #define CYTHON_ASSUME_SAFE_MACROS 1 112 #ifndef CYTHON_UNPACK_METHODS 113 #define CYTHON_UNPACK_METHODS 1 115 #undef CYTHON_FAST_THREAD_STATE 116 #define CYTHON_FAST_THREAD_STATE 0 117 #undef CYTHON_FAST_PYCALL 118 #define CYTHON_FAST_PYCALL 0 119 #undef CYTHON_PEP489_MULTI_PHASE_INIT 120 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 121 #undef CYTHON_USE_TP_FINALIZE 122 #define CYTHON_USE_TP_FINALIZE 0 123 #undef CYTHON_USE_DICT_VERSIONS 124 #define CYTHON_USE_DICT_VERSIONS 0 125 #undef CYTHON_USE_EXC_INFO_STACK 126 #define CYTHON_USE_EXC_INFO_STACK 0 128 #define CYTHON_COMPILING_IN_PYPY 0 129 #define CYTHON_COMPILING_IN_PYSTON 0 130 #define CYTHON_COMPILING_IN_CPYTHON 1 131 #ifndef CYTHON_USE_TYPE_SLOTS 132 #define CYTHON_USE_TYPE_SLOTS 1 134 #if PY_VERSION_HEX < 0x02070000 135 #undef CYTHON_USE_PYTYPE_LOOKUP 136 #define CYTHON_USE_PYTYPE_LOOKUP 0 137 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) 138 #define CYTHON_USE_PYTYPE_LOOKUP 1 140 #if PY_MAJOR_VERSION < 3 141 #undef CYTHON_USE_ASYNC_SLOTS 142 #define CYTHON_USE_ASYNC_SLOTS 0 143 #elif !defined(CYTHON_USE_ASYNC_SLOTS) 144 #define CYTHON_USE_ASYNC_SLOTS 1 146 #if PY_VERSION_HEX < 0x02070000 147 #undef CYTHON_USE_PYLONG_INTERNALS 148 #define CYTHON_USE_PYLONG_INTERNALS 0 149 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) 150 #define CYTHON_USE_PYLONG_INTERNALS 1 152 #ifndef CYTHON_USE_PYLIST_INTERNALS 153 #define CYTHON_USE_PYLIST_INTERNALS 1 155 #ifndef CYTHON_USE_UNICODE_INTERNALS 156 #define CYTHON_USE_UNICODE_INTERNALS 1 158 #if PY_VERSION_HEX < 0x030300F0 159 #undef CYTHON_USE_UNICODE_WRITER 160 #define CYTHON_USE_UNICODE_WRITER 0 161 #elif !defined(CYTHON_USE_UNICODE_WRITER) 162 #define CYTHON_USE_UNICODE_WRITER 1 164 #ifndef CYTHON_AVOID_BORROWED_REFS 165 #define CYTHON_AVOID_BORROWED_REFS 0 167 #ifndef CYTHON_ASSUME_SAFE_MACROS 168 #define CYTHON_ASSUME_SAFE_MACROS 1 170 #ifndef CYTHON_UNPACK_METHODS 171 #define CYTHON_UNPACK_METHODS 1 173 #ifndef CYTHON_FAST_THREAD_STATE 174 #define CYTHON_FAST_THREAD_STATE 1 176 #ifndef CYTHON_FAST_PYCALL 177 #define CYTHON_FAST_PYCALL 1 179 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT 180 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) 182 #ifndef CYTHON_USE_TP_FINALIZE 183 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) 185 #ifndef CYTHON_USE_DICT_VERSIONS 186 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) 188 #ifndef CYTHON_USE_EXC_INFO_STACK 189 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) 192 #if !defined(CYTHON_FAST_PYCCALL) 193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) 195 #if CYTHON_USE_PYLONG_INTERNALS 196 #include "longintrepr.h" 201 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
204 #ifndef __has_attribute 205 #define __has_attribute(x) 0 207 #ifndef __has_cpp_attribute 208 #define __has_cpp_attribute(x) 0 210 #ifndef CYTHON_RESTRICT 211 #if defined(__GNUC__) 212 #define CYTHON_RESTRICT __restrict__ 213 #elif defined(_MSC_VER) && _MSC_VER >= 1400 214 #define CYTHON_RESTRICT __restrict 215 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 216 #define CYTHON_RESTRICT restrict 218 #define CYTHON_RESTRICT 221 #ifndef CYTHON_UNUSED 222 # if defined(__GNUC__) 223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 224 # define CYTHON_UNUSED __attribute__ ((__unused__)) 226 # define CYTHON_UNUSED 228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) 229 # define CYTHON_UNUSED __attribute__ ((__unused__)) 231 # define CYTHON_UNUSED 234 #ifndef CYTHON_MAYBE_UNUSED_VAR 235 # if defined(__cplusplus) 236 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) 241 #ifndef CYTHON_NCP_UNUSED 242 # if CYTHON_COMPILING_IN_CPYTHON 243 # define CYTHON_NCP_UNUSED 245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED 248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) 250 #ifndef _MSC_STDINT_H_ 252 typedef unsigned char uint8_t;
253 typedef unsigned int uint32_t;
255 typedef unsigned __int8 uint8_t;
256 typedef unsigned __int32 uint32_t;
262 #ifndef CYTHON_FALLTHROUGH 263 #if defined(__cplusplus) && __cplusplus >= 201103L 264 #if __has_cpp_attribute(fallthrough) 265 #define CYTHON_FALLTHROUGH [[fallthrough]] 266 #elif __has_cpp_attribute(clang::fallthrough) 267 #define CYTHON_FALLTHROUGH [[clang::fallthrough]] 268 #elif __has_cpp_attribute(gnu::fallthrough) 269 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] 272 #ifndef CYTHON_FALLTHROUGH 273 #if __has_attribute(fallthrough) 274 #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) 276 #define CYTHON_FALLTHROUGH 279 #if defined(__clang__ ) && defined(__apple_build_version__) 280 #if __apple_build_version__ < 7000000 281 #undef CYTHON_FALLTHROUGH 282 #define CYTHON_FALLTHROUGH 287 #ifndef CYTHON_INLINE 288 #if defined(__clang__) 289 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) 290 #elif defined(__GNUC__) 291 #define CYTHON_INLINE __inline__ 292 #elif defined(_MSC_VER) 293 #define CYTHON_INLINE __inline 294 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 295 #define CYTHON_INLINE inline 297 #define CYTHON_INLINE 301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) 302 #define Py_OptimizeFlag 0 304 #define __PYX_BUILD_PY_SSIZE_T "n" 305 #define CYTHON_FORMAT_SSIZE_T "z" 306 #if PY_MAJOR_VERSION < 3 307 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" 308 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 309 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 310 #define __Pyx_DefaultClassType PyClass_Type 312 #define __Pyx_BUILTIN_MODULE_NAME "builtins" 313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 314 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 315 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 317 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 318 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 320 #define __Pyx_DefaultClassType PyType_Type 322 #ifndef Py_TPFLAGS_CHECKTYPES 323 #define Py_TPFLAGS_CHECKTYPES 0 325 #ifndef Py_TPFLAGS_HAVE_INDEX 326 #define Py_TPFLAGS_HAVE_INDEX 0 328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER 329 #define Py_TPFLAGS_HAVE_NEWBUFFER 0 331 #ifndef Py_TPFLAGS_HAVE_FINALIZE 332 #define Py_TPFLAGS_HAVE_FINALIZE 0 334 #ifndef METH_STACKLESS 335 #define METH_STACKLESS 0 337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) 338 #ifndef METH_FASTCALL 339 #define METH_FASTCALL 0x80 341 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
342 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
343 Py_ssize_t nargs, PyObject *kwnames);
345 #define __Pyx_PyCFunctionFast _PyCFunctionFast 346 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords 348 #if CYTHON_FAST_PYCCALL 349 #define __Pyx_PyFastCFunction_Check(func)\ 350 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) 352 #define __Pyx_PyFastCFunction_Check(func) 0 354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) 355 #define PyObject_Malloc(s) PyMem_Malloc(s) 356 #define PyObject_Free(p) PyMem_Free(p) 357 #define PyObject_Realloc(p) PyMem_Realloc(p) 359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 360 #define PyMem_RawMalloc(n) PyMem_Malloc(n) 361 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) 362 #define PyMem_RawFree(p) PyMem_Free(p) 364 #if CYTHON_COMPILING_IN_PYSTON 365 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) 366 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) 368 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) 369 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) 371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 372 #define __Pyx_PyThreadState_Current PyThreadState_GET() 373 #elif PY_VERSION_HEX >= 0x03060000 374 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() 375 #elif PY_VERSION_HEX >= 0x03000000 376 #define __Pyx_PyThreadState_Current PyThreadState_GET() 378 #define __Pyx_PyThreadState_Current _PyThreadState_Current 380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) 381 #include "pythread.h" 382 #define Py_tss_NEEDS_INIT 0 383 typedef int Py_tss_t;
384 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
385 *key = PyThread_create_key();
388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
389 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
390 *key = Py_tss_NEEDS_INIT;
393 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
396 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
397 return *key != Py_tss_NEEDS_INIT;
399 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
400 PyThread_delete_key(*key);
401 *key = Py_tss_NEEDS_INIT;
403 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
404 return PyThread_set_key_value(*key, value);
406 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
407 return PyThread_get_key_value(*key);
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) 411 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) 413 #define __Pyx_PyDict_NewPresized(n) PyDict_New() 415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION 416 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) 417 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) 419 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) 420 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) 422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS 423 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) 425 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) 427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) 428 #define CYTHON_PEP393_ENABLED 1 429 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 430 0 : _PyUnicode_Ready((PyObject *)(op))) 431 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) 432 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) 433 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) 434 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) 435 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) 436 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) 437 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) 438 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) 440 #define CYTHON_PEP393_ENABLED 0 441 #define PyUnicode_1BYTE_KIND 1 442 #define PyUnicode_2BYTE_KIND 2 443 #define PyUnicode_4BYTE_KIND 4 444 #define __Pyx_PyUnicode_READY(op) (0) 445 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) 446 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) 447 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) 448 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) 449 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) 450 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) 451 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) 452 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) 454 #if CYTHON_COMPILING_IN_PYPY 455 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) 456 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) 458 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) 459 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ 460 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) 462 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) 463 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) 465 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) 466 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) 468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) 469 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) 471 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) 472 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) 473 #if PY_MAJOR_VERSION >= 3 474 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) 476 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) 478 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) 479 #define PyObject_ASCII(o) PyObject_Repr(o) 481 #if PY_MAJOR_VERSION >= 3 482 #define PyBaseString_Type PyUnicode_Type 483 #define PyStringObject PyUnicodeObject 484 #define PyString_Type PyUnicode_Type 485 #define PyString_Check PyUnicode_Check 486 #define PyString_CheckExact PyUnicode_CheckExact 487 #ifndef PyObject_Unicode 488 #define PyObject_Unicode PyObject_Str 491 #if PY_MAJOR_VERSION >= 3 492 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) 493 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) 495 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) 496 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) 498 #ifndef PySet_CheckExact 499 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) 501 #if CYTHON_ASSUME_SAFE_MACROS 502 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) 504 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) 506 #if PY_MAJOR_VERSION >= 3 507 #define PyIntObject PyLongObject 508 #define PyInt_Type PyLong_Type 509 #define PyInt_Check(op) PyLong_Check(op) 510 #define PyInt_CheckExact(op) PyLong_CheckExact(op) 511 #define PyInt_FromString PyLong_FromString 512 #define PyInt_FromUnicode PyLong_FromUnicode 513 #define PyInt_FromLong PyLong_FromLong 514 #define PyInt_FromSize_t PyLong_FromSize_t 515 #define PyInt_FromSsize_t PyLong_FromSsize_t 516 #define PyInt_AsLong PyLong_AsLong 517 #define PyInt_AS_LONG PyLong_AS_LONG 518 #define PyInt_AsSsize_t PyLong_AsSsize_t 519 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask 520 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask 521 #define PyNumber_Int PyNumber_Long 523 #if PY_MAJOR_VERSION >= 3 524 #define PyBoolObject PyLongObject 526 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY 527 #ifndef PyUnicode_InternFromString 528 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) 531 #if PY_VERSION_HEX < 0x030200A4 532 typedef long Py_hash_t;
533 #define __Pyx_PyInt_FromHash_t PyInt_FromLong 534 #define __Pyx_PyInt_AsHash_t PyInt_AsLong 536 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t 537 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t 539 #if PY_MAJOR_VERSION >= 3 540 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) 542 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) 544 #if CYTHON_USE_ASYNC_SLOTS 545 #if PY_VERSION_HEX >= 0x030500B1 546 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods 547 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) 549 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) 552 #define __Pyx_PyType_AsAsync(obj) NULL 554 #ifndef __Pyx_PyAsyncMethodsStruct 559 } __Pyx_PyAsyncMethodsStruct;
562 #if defined(WIN32) || defined(MS_WINDOWS) 563 #define _USE_MATH_DEFINES 567 #define __PYX_NAN() ((float) NAN) 569 static CYTHON_INLINE
float __PYX_NAN() {
571 memset(&value, 0xFF,
sizeof(value));
575 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) 576 #define __Pyx_truncl trunc 578 #define __Pyx_truncl truncl 582 #define __PYX_ERR(f_index, lineno, Ln_error) \ 584 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ 587 #ifndef __PYX_EXTERN_C 589 #define __PYX_EXTERN_C extern "C" 591 #define __PYX_EXTERN_C extern 595 #define __PYX_HAVE__superluWrappers 596 #define __PYX_HAVE_API__superluWrappers 600 #include "numpy/arrayobject.h" 601 #include "numpy/ufuncobject.h" 604 #include "pythread.h" 610 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) 611 #define CYTHON_WITHOUT_ASSERTIONS 614 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
615 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
617 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 618 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 619 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) 620 #define __PYX_DEFAULT_STRING_ENCODING "" 621 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString 622 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 623 #define __Pyx_uchar_cast(c) ((unsigned char)c) 624 #define __Pyx_long_cast(x) ((long)x) 625 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ 626 (sizeof(type) < sizeof(Py_ssize_t)) ||\ 627 (sizeof(type) > sizeof(Py_ssize_t) &&\ 628 likely(v < (type)PY_SSIZE_T_MAX ||\ 629 v == (type)PY_SSIZE_T_MAX) &&\ 630 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ 631 v == (type)PY_SSIZE_T_MIN))) ||\ 632 (sizeof(type) == sizeof(Py_ssize_t) &&\ 633 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ 634 v == (type)PY_SSIZE_T_MAX))) ) 635 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
636 return (
size_t) i < (size_t) limit;
638 #if defined (__cplusplus) && __cplusplus >= 201103L 640 #define __Pyx_sst_abs(value) std::abs(value) 641 #elif SIZEOF_INT >= SIZEOF_SIZE_T 642 #define __Pyx_sst_abs(value) abs(value) 643 #elif SIZEOF_LONG >= SIZEOF_SIZE_T 644 #define __Pyx_sst_abs(value) labs(value) 645 #elif defined (_MSC_VER) 646 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) 647 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 648 #define __Pyx_sst_abs(value) llabs(value) 649 #elif defined (__GNUC__) 650 #define __Pyx_sst_abs(value) __builtin_llabs(value) 652 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) 654 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
655 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
656 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) 657 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) 658 #define __Pyx_PyBytes_FromString PyBytes_FromString 659 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize 660 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
661 #if PY_MAJOR_VERSION < 3 662 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString 663 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 665 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString 666 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize 668 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) 669 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) 670 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) 671 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) 672 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) 673 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) 674 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) 675 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) 676 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) 677 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) 678 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) 679 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) 680 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) 681 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) 682 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) 683 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) 684 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
685 const Py_UNICODE *u_end =
u;
687 return (
size_t)(u_end - u - 1);
689 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) 690 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode 691 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode 692 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) 693 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) 694 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
695 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
696 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
697 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
698 #define __Pyx_PySequence_Tuple(obj)\ 699 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) 700 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
701 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
702 #if CYTHON_ASSUME_SAFE_MACROS 703 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) 705 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) 707 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) 708 #if PY_MAJOR_VERSION >= 3 709 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) 711 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) 713 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) 714 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 715 static int __Pyx_sys_getdefaultencoding_not_ascii;
716 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
718 PyObject* default_encoding = NULL;
719 PyObject* ascii_chars_u = NULL;
720 PyObject* ascii_chars_b = NULL;
721 const char* default_encoding_c;
722 sys = PyImport_ImportModule(
"sys");
724 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
726 if (!default_encoding)
goto bad;
727 default_encoding_c = PyBytes_AsString(default_encoding);
728 if (!default_encoding_c)
goto bad;
729 if (strcmp(default_encoding_c,
"ascii") == 0) {
730 __Pyx_sys_getdefaultencoding_not_ascii = 0;
732 char ascii_chars[128];
734 for (c = 0; c < 128; c++) {
737 __Pyx_sys_getdefaultencoding_not_ascii = 1;
738 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
739 if (!ascii_chars_u)
goto bad;
740 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
741 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
744 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
748 Py_DECREF(ascii_chars_u);
749 Py_DECREF(ascii_chars_b);
751 Py_DECREF(default_encoding);
754 Py_XDECREF(default_encoding);
755 Py_XDECREF(ascii_chars_u);
756 Py_XDECREF(ascii_chars_b);
760 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 761 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) 763 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) 764 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 765 static char* __PYX_DEFAULT_STRING_ENCODING;
766 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
768 PyObject* default_encoding = NULL;
769 char* default_encoding_c;
770 sys = PyImport_ImportModule(
"sys");
772 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
774 if (!default_encoding)
goto bad;
775 default_encoding_c = PyBytes_AsString(default_encoding);
776 if (!default_encoding_c)
goto bad;
777 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
778 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
779 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
780 Py_DECREF(default_encoding);
783 Py_XDECREF(default_encoding);
791 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) 792 #define likely(x) __builtin_expect(!!(x), 1) 793 #define unlikely(x) __builtin_expect(!!(x), 0) 795 #define likely(x) (x) 796 #define unlikely(x) (x) 798 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
800 static PyObject *__pyx_m = NULL;
801 static PyObject *__pyx_d;
802 static PyObject *__pyx_b;
803 static PyObject *__pyx_cython_runtime = NULL;
804 static PyObject *__pyx_empty_tuple;
805 static PyObject *__pyx_empty_bytes;
806 static PyObject *__pyx_empty_unicode;
807 static int __pyx_lineno;
808 static int __pyx_clineno = 0;
809 static const char * __pyx_cfilenm= __FILE__;
810 static const char *__pyx_filename;
813 #if !defined(CYTHON_CCOMPLEX) 814 #if defined(__cplusplus) 815 #define CYTHON_CCOMPLEX 1 816 #elif defined(_Complex_I) 817 #define CYTHON_CCOMPLEX 1 819 #define CYTHON_CCOMPLEX 0 829 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) 831 #define _Complex_I 1.0fj 835 static const char *__pyx_f[] = {
836 "proteus/superluWrappers.pyx",
838 "linux/lib/python3.7/site-packages/Cython/Includes/numpy/__init__.pxd",
839 "linux/lib/python3.7/site-packages/Cython/Includes/cpython/type.pxd",
842 struct __pyx_memoryview_obj;
844 struct __pyx_memoryview_obj *memview;
847 Py_ssize_t strides[8];
848 Py_ssize_t suboffsets[8];
849 } __Pyx_memviewslice;
850 #define __Pyx_MemoryView_Len(m) (m.shape[0]) 853 #include <pythread.h> 854 #ifndef CYTHON_ATOMICS 855 #define CYTHON_ATOMICS 1 857 #define __pyx_atomic_int_type int 858 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\ 859 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\ 861 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1) 862 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1) 863 #ifdef __PYX_DEBUG_ATOMICS 864 #warning "Using GNU atomics" 866 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0 868 #undef __pyx_atomic_int_type 869 #define __pyx_atomic_int_type LONG 870 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value) 871 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value) 872 #ifdef __PYX_DEBUG_ATOMICS 873 #pragma message ("Using MSVC atomics") 875 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0 876 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value) 877 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value) 878 #ifdef __PYX_DEBUG_ATOMICS 879 #warning "Using Intel atomics" 882 #undef CYTHON_ATOMICS 883 #define CYTHON_ATOMICS 0 884 #ifdef __PYX_DEBUG_ATOMICS 885 #warning "Not using atomics" 888 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
890 #define __pyx_add_acquisition_count(memview)\ 891 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock) 892 #define __pyx_sub_acquisition_count(memview)\ 893 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock) 895 #define __pyx_add_acquisition_count(memview)\ 896 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) 897 #define __pyx_sub_acquisition_count(memview)\ 898 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock) 902 #ifndef __PYX_FORCE_INIT_THREADS 903 #define __PYX_FORCE_INIT_THREADS 0 907 #define __Pyx_PyGILState_Ensure PyGILState_Ensure 908 #define __Pyx_PyGILState_Release PyGILState_Release 909 #define __Pyx_FastGIL_Remember() 910 #define __Pyx_FastGIL_Forget() 911 #define __Pyx_FastGilFuncInit() 914 #define IS_UNSIGNED(type) (((type) -1) > 0) 915 struct __Pyx_StructField_;
916 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) 919 struct __Pyx_StructField_* fields;
927 typedef struct __Pyx_StructField_ {
928 __Pyx_TypeInfo* type;
933 __Pyx_StructField* field;
934 size_t parent_offset;
935 } __Pyx_BufFmt_StackElem;
937 __Pyx_StructField root;
938 __Pyx_BufFmt_StackElem* head;
940 size_t new_count, enc_count;
941 size_t struct_alignment;
947 } __Pyx_BufFmt_Context;
957 typedef npy_int8 __pyx_t_5numpy_int8_t;
966 typedef npy_int16 __pyx_t_5numpy_int16_t;
975 typedef npy_int32 __pyx_t_5numpy_int32_t;
984 typedef npy_int64 __pyx_t_5numpy_int64_t;
993 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1002 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1011 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1020 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1029 typedef npy_float32 __pyx_t_5numpy_float32_t;
1038 typedef npy_float64 __pyx_t_5numpy_float64_t;
1047 typedef npy_long __pyx_t_5numpy_int_t;
1056 typedef npy_longlong __pyx_t_5numpy_long_t;
1065 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1074 typedef npy_ulong __pyx_t_5numpy_uint_t;
1083 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1092 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1101 typedef npy_intp __pyx_t_5numpy_intp_t;
1110 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1119 typedef npy_double __pyx_t_5numpy_float_t;
1128 typedef npy_double __pyx_t_5numpy_double_t;
1137 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1141 typedef ::std::complex< float > __pyx_t_float_complex;
1143 typedef float _Complex __pyx_t_float_complex;
1146 typedef struct {
float real, imag; } __pyx_t_float_complex;
1148 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1153 typedef ::std::complex< double > __pyx_t_double_complex;
1155 typedef double _Complex __pyx_t_double_complex;
1158 typedef struct {
double real, imag; } __pyx_t_double_complex;
1160 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1164 struct __pyx_obj_15superluWrappers_cSparseMatrix;
1165 struct __pyx_obj_15superluWrappers_SparseFactor;
1166 struct __pyx_array_obj;
1167 struct __pyx_MemviewEnum_obj;
1168 struct __pyx_memoryview_obj;
1169 struct __pyx_memoryviewslice_obj;
1178 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1187 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1196 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1205 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1206 struct __pyx_t_15superluWrappers__NRformat;
1207 struct __pyx_t_15superluWrappers__NCformat;
1208 struct __pyx_t_15superluWrappers__DNformat;
1209 struct __pyx_t_15superluWrappers__NCPformat;
1218 struct __pyx_t_15superluWrappers__NRformat {
1219 __pyx_t_5numpy_int32_t
nnz;
1220 __pyx_t_5numpy_float64_t *nzval;
1221 __pyx_t_5numpy_int32_t *colind;
1222 __pyx_t_5numpy_int32_t *rowptr;
1232 struct __pyx_t_15superluWrappers__NCformat {
1233 __pyx_t_5numpy_int32_t
nnz;
1234 __pyx_t_5numpy_float64_t *nzval;
1235 __pyx_t_5numpy_int32_t *rowind;
1236 __pyx_t_5numpy_int32_t *colptr;
1246 struct __pyx_t_15superluWrappers__DNformat {
1247 __pyx_t_5numpy_int32_t lda;
1258 struct __pyx_t_15superluWrappers__NCPformat {
1259 __pyx_t_5numpy_int32_t
nnz;
1261 __pyx_t_5numpy_int32_t *rowind;
1262 __pyx_t_5numpy_int32_t *colbeg;
1263 __pyx_t_5numpy_int32_t *colend;
1273 struct __pyx_obj_15superluWrappers_cSparseMatrix {
1275 __pyx_t_5numpy_int32_t dim[2];
1276 struct __pyx_t_15superluWrappers__NRformat A;
1287 struct __pyx_obj_15superluWrappers_SparseFactor {
1289 struct __pyx_vtabstruct_15superluWrappers_SparseFactor *__pyx_vtab;
1290 superlu_options_t options;
1298 struct __pyx_t_15superluWrappers__NCformat storeA;
1299 struct __pyx_t_15superluWrappers__DNformat storeX;
1303 unsigned int use_same_perm_c;
1304 unsigned int use_same_sparsity;
1316 struct __pyx_array_obj {
1318 struct __pyx_vtabstruct_array *__pyx_vtab;
1324 Py_ssize_t *_strides;
1325 Py_ssize_t itemsize;
1328 void (*callback_free_data)(
void *);
1330 int dtype_is_object;
1341 struct __pyx_MemviewEnum_obj {
1354 struct __pyx_memoryview_obj {
1356 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1359 PyObject *_array_interface;
1360 PyThread_type_lock lock;
1361 __pyx_atomic_int acquisition_count[2];
1362 __pyx_atomic_int *acquisition_count_aligned_p;
1365 int dtype_is_object;
1366 __Pyx_TypeInfo *typeinfo;
1377 struct __pyx_memoryviewslice_obj {
1378 struct __pyx_memoryview_obj __pyx_base;
1379 __Pyx_memviewslice from_slice;
1380 PyObject *from_object;
1381 PyObject *(*to_object_func)(
char *);
1382 int (*to_dtype_func)(
char *, PyObject *);
1395 struct __pyx_vtabstruct_15superluWrappers_SparseFactor {
1396 PyObject *(*_set_mat_types)(
struct __pyx_obj_15superluWrappers_SparseFactor *);
1398 static struct __pyx_vtabstruct_15superluWrappers_SparseFactor *__pyx_vtabptr_15superluWrappers_SparseFactor;
1409 struct __pyx_vtabstruct_array {
1410 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1412 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1423 struct __pyx_vtabstruct_memoryview {
1424 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1425 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1426 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1427 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1428 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1429 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1430 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1432 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1443 struct __pyx_vtabstruct__memoryviewslice {
1444 struct __pyx_vtabstruct_memoryview __pyx_base;
1446 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1450 #ifndef CYTHON_REFNANNY 1451 #define CYTHON_REFNANNY 0 1455 void (*INCREF)(
void*, PyObject*, int);
1456 void (*DECREF)(
void*, PyObject*, int);
1457 void (*GOTREF)(
void*, PyObject*, int);
1458 void (*GIVEREF)(
void*, PyObject*, int);
1459 void* (*SetupContext)(
const char*, int,
const char*);
1460 void (*FinishContext)(
void**);
1461 } __Pyx_RefNannyAPIStruct;
1462 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1463 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1464 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; 1466 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 1468 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 1469 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 1470 PyGILState_Release(__pyx_gilstate_save);\ 1472 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 1475 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 1476 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) 1478 #define __Pyx_RefNannyFinishContext()\ 1479 __Pyx_RefNanny->FinishContext(&__pyx_refnanny) 1480 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 1481 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 1482 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 1483 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 1484 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) 1485 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) 1486 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) 1487 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) 1489 #define __Pyx_RefNannyDeclarations 1490 #define __Pyx_RefNannySetupContext(name, acquire_gil) 1491 #define __Pyx_RefNannyFinishContext() 1492 #define __Pyx_INCREF(r) Py_INCREF(r) 1493 #define __Pyx_DECREF(r) Py_DECREF(r) 1494 #define __Pyx_GOTREF(r) 1495 #define __Pyx_GIVEREF(r) 1496 #define __Pyx_XINCREF(r) Py_XINCREF(r) 1497 #define __Pyx_XDECREF(r) Py_XDECREF(r) 1498 #define __Pyx_XGOTREF(r) 1499 #define __Pyx_XGIVEREF(r) 1501 #define __Pyx_XDECREF_SET(r, v) do {\ 1502 PyObject *tmp = (PyObject *) r;\ 1503 r = v; __Pyx_XDECREF(tmp);\ 1505 #define __Pyx_DECREF_SET(r, v) do {\ 1506 PyObject *tmp = (PyObject *) r;\ 1507 r = v; __Pyx_DECREF(tmp);\ 1509 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) 1510 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) 1513 #if CYTHON_USE_TYPE_SLOTS 1514 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1516 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) 1520 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1523 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1524 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1527 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1530 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1531 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1532 const char* function_name);
1535 #if CYTHON_USE_TYPE_SLOTS 1536 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) 1537 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1539 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) 1540 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) 1544 #if CYTHON_COMPILING_IN_CPYTHON 1545 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1547 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) 1551 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1554 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d 1555 #define __Pyx_MEMVIEW_DIRECT 1 1556 #define __Pyx_MEMVIEW_PTR 2 1557 #define __Pyx_MEMVIEW_FULL 4 1558 #define __Pyx_MEMVIEW_CONTIG 8 1559 #define __Pyx_MEMVIEW_STRIDED 16 1560 #define __Pyx_MEMVIEW_FOLLOW 32 1561 #define __Pyx_IS_C_CONTIG 1 1562 #define __Pyx_IS_F_CONTIG 2 1563 static int __Pyx_init_memviewslice(
1564 struct __pyx_memoryview_obj *memview,
1566 __Pyx_memviewslice *memviewslice,
1567 int memview_is_new_reference);
1568 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
1569 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1570 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
1571 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1572 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p) 1573 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview)) 1574 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__) 1575 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__) 1576 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1577 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1580 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS 1581 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
1583 PyTypeObject *tp = Py_TYPE(obj);
1584 #if PY_MAJOR_VERSION < 3 1585 if (unlikely(PyInstance_Check(obj)))
1586 return __Pyx_PyObject_GetAttrStr(obj, attr_name);
1588 res = _PyType_Lookup(tp, attr_name);
1590 descrgetfunc
f = Py_TYPE(res)->tp_descr_get;
1594 res =
f(res, obj, (PyObject *)tp);
1597 PyErr_SetObject(PyExc_AttributeError, attr_name);
1602 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) 1606 #if CYTHON_FAST_PYCALL 1607 #define __Pyx_PyFunction_FastCall(func, args, nargs)\ 1608 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) 1609 #if 1 || PY_VERSION_HEX < 0x030600B1 1610 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1612 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) 1614 #define __Pyx_BUILD_ASSERT_EXPR(cond)\ 1615 (sizeof(char [1 - 2*!(cond)]) - 1) 1616 #ifndef Py_MEMBER_SIZE 1617 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) 1619 static size_t __pyx_pyframe_localsplus_offset = 0;
1620 #include "frameobject.h" 1621 #define __Pxy_PyFrame_Initialize_Offsets()\ 1622 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ 1623 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) 1624 #define __Pyx_PyFrame_GetLocalsplus(frame)\ 1625 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) 1629 #if CYTHON_COMPILING_IN_CPYTHON 1630 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1634 #if CYTHON_COMPILING_IN_CPYTHON 1635 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1637 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) 1641 #if CYTHON_FAST_PYCCALL 1642 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1644 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) 1648 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1651 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ 1652 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ 1653 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ 1654 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ 1655 __Pyx_GetItemInt_Generic(o, to_py_func(i)))) 1656 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ 1657 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ 1658 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ 1659 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) 1660 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1661 int wraparound,
int boundscheck);
1662 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ 1663 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ 1664 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ 1665 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) 1666 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1667 int wraparound,
int boundscheck);
1668 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1669 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1670 int is_list,
int wraparound,
int boundscheck);
1673 #if CYTHON_USE_TYPE_SLOTS 1674 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1676 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) 1680 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
1683 #if !CYTHON_COMPILING_IN_PYPY 1684 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
1686 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ 1687 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) 1691 #if CYTHON_USE_EXC_INFO_STACK 1692 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1696 #if CYTHON_FAST_THREAD_STATE 1697 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; 1698 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; 1699 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type 1701 #define __Pyx_PyThreadState_declare 1702 #define __Pyx_PyThreadState_assign 1703 #define __Pyx_PyErr_Occurred() PyErr_Occurred() 1707 #if CYTHON_FAST_THREAD_STATE 1708 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) 1709 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1710 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) 1711 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1713 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) 1714 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) 1718 #if CYTHON_FAST_THREAD_STATE 1719 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) 1720 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1722 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1726 #if CYTHON_FAST_THREAD_STATE 1727 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) 1728 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) 1729 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) 1730 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) 1731 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) 1732 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1733 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1734 #if CYTHON_COMPILING_IN_CPYTHON 1735 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) 1737 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) 1740 #define __Pyx_PyErr_Clear() PyErr_Clear() 1741 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) 1742 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) 1743 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) 1744 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) 1745 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) 1746 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) 1747 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) 1751 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1752 PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1753 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1754 int has_cstart,
int has_cstop,
int wraparound);
1757 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1760 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
1761 int lineno,
const char *filename,
1762 int full_traceback,
int nogil);
1765 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY 1766 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1767 #define __Pyx_PyObject_Dict_GetItem(obj, name)\ 1768 (likely(PyDict_CheckExact(obj)) ?\ 1769 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) 1771 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) 1772 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) 1776 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1779 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1782 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
1785 #if CYTHON_FAST_THREAD_STATE 1786 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) 1787 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1789 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) 1793 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ 1794 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ 1795 __Pyx__ArgTypeTest(obj, type, name, exact)) 1796 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1802 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1805 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1808 #if PY_MAJOR_VERSION >= 3 1809 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals 1811 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals 1815 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1818 #define UNARY_NEG_WOULD_OVERFLOW(x)\ 1819 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) 1821 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1822 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1824 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1827 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *
s, Py_ssize_t size,
const char *errors) {
1829 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1831 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *
s, Py_ssize_t size,
const char *errors) {
1833 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1835 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *
s, Py_ssize_t size,
const char *errors) {
1837 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1841 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1842 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1843 const char* encoding,
const char* errors,
1844 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors));
1847 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1850 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS 1851 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) 1852 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) 1853 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ 1854 (version_var) = __PYX_GET_DICT_VERSION(dict);\ 1855 (cache_var) = (value); 1856 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ 1857 static PY_UINT64_T __pyx_dict_version = 0;\ 1858 static PyObject *__pyx_dict_cached_value = NULL;\ 1859 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ 1860 (VAR) = __pyx_dict_cached_value;\ 1862 (VAR) = __pyx_dict_cached_value = (LOOKUP);\ 1863 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ 1866 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1867 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1868 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1870 #define __PYX_GET_DICT_VERSION(dict) (0) 1871 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) 1872 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); 1876 #if CYTHON_USE_DICT_VERSIONS 1877 #define __Pyx_GetModuleGlobalName(var, name) {\ 1878 static PY_UINT64_T __pyx_dict_version = 0;\ 1879 static PyObject *__pyx_dict_cached_value = NULL;\ 1880 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ 1881 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ 1882 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ 1884 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\ 1885 PY_UINT64_T __pyx_dict_version;\ 1886 PyObject *__pyx_dict_cached_value;\ 1887 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ 1889 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1891 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) 1892 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) 1893 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1897 #if CYTHON_FAST_THREAD_STATE 1898 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) 1899 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1901 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1905 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1908 #if CYTHON_COMPILING_IN_CPYTHON 1909 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) 1910 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1911 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1912 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1914 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) 1915 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) 1916 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) 1918 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) 1920 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1922 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS 1923 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1924 PyListObject*
L = (PyListObject*) list;
1925 Py_ssize_t len = Py_SIZE(list);
1926 if (likely(L->allocated > len)) {
1928 PyList_SET_ITEM(list, len, x);
1929 Py_SIZE(list) = len+1;
1932 return PyList_Append(list, x);
1935 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) 1939 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject*
L, PyObject*
v) {
1940 #if CYTHON_COMPILING_IN_CPYTHON 1941 PyObject* none = _PyList_Extend((PyListObject*)
L, v);
1942 if (unlikely(!none))
1947 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1952 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS 1953 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1954 PyListObject*
L = (PyListObject*) list;
1955 Py_ssize_t len = Py_SIZE(list);
1956 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1958 PyList_SET_ITEM(list, len, x);
1959 Py_SIZE(list) = len+1;
1962 return PyList_Append(list, x);
1965 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) 1969 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1972 static CYTHON_INLINE
long __Pyx_div_long(
long,
long);
1975 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1978 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
1981 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 1982 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1984 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr 1988 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 1989 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1991 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr 1995 static int __Pyx_setup_reduce(PyObject* type_obj);
1998 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
2001 #ifndef __PYX_HAVE_RT_ImportType_proto 2002 #define __PYX_HAVE_RT_ImportType_proto 2003 enum __Pyx_ImportType_CheckSize {
2004 __Pyx_ImportType_CheckSize_Error = 0,
2005 __Pyx_ImportType_CheckSize_Warn = 1,
2006 __Pyx_ImportType_CheckSize_Ignore = 2
2008 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
2012 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
2015 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2018 #define __Pyx_CyFunction_USED 1 2019 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 2020 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 2021 #define __Pyx_CYFUNCTION_CCLASS 0x04 2022 #define __Pyx_CyFunction_GetClosure(f)\ 2023 (((__pyx_CyFunctionObject *) (f))->func_closure) 2024 #define __Pyx_CyFunction_GetClassObj(f)\ 2025 (((__pyx_CyFunctionObject *) (f))->func_classobj) 2026 #define __Pyx_CyFunction_Defaults(type, f)\ 2027 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) 2028 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ 2029 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) 2031 PyCFunctionObject func;
2032 #if PY_VERSION_HEX < 0x030500A0 2033 PyObject *func_weakreflist;
2035 PyObject *func_dict;
2036 PyObject *func_name;
2037 PyObject *func_qualname;
2039 PyObject *func_globals;
2040 PyObject *func_code;
2041 PyObject *func_closure;
2042 PyObject *func_classobj;
2044 int defaults_pyobjects;
2045 size_t defaults_size;
2047 PyObject *defaults_tuple;
2048 PyObject *defaults_kwdict;
2049 PyObject *(*defaults_getter)(PyObject *);
2050 PyObject *func_annotations;
2051 } __pyx_CyFunctionObject;
2052 static PyTypeObject *__pyx_CyFunctionType = 0;
2053 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) 2054 #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ 2055 __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) 2056 static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
2057 int flags, PyObject* qualname,
2059 PyObject *module, PyObject *globals,
2061 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2064 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2066 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2068 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2070 static int __pyx_CyFunction_init(
void);
2073 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 2074 #define __Pyx_SetNameInClass(ns, name, value)\ 2075 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) 2076 #elif CYTHON_COMPILING_IN_CPYTHON 2077 #define __Pyx_SetNameInClass(ns, name, value)\ 2078 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) 2080 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) 2084 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
2085 PyObject *mkw, PyObject *modname, PyObject *doc);
2086 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
2087 PyObject *mkw,
int calculate_metaclass,
int allow_py2_metaclass);
2090 #ifdef CYTHON_CLINE_IN_TRACEBACK 2091 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) 2093 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2098 PyCodeObject* code_object;
2100 } __Pyx_CodeObjectCacheEntry;
2101 struct __Pyx_CodeObjectCache {
2104 __Pyx_CodeObjectCacheEntry* entries;
2106 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2107 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2108 static PyCodeObject *__pyx_find_code_object(
int code_line);
2109 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2112 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2113 int py_line,
const char *filename);
2115 #if PY_MAJOR_VERSION < 3 2116 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2117 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2119 #define __Pyx_GetBuffer PyObject_GetBuffer 2120 #define __Pyx_ReleaseBuffer PyBuffer_Release 2126 Py_ssize_t shape, strides, suboffsets;
2127 } __Pyx_Buf_DimInfo;
2133 __Pyx_Buffer *rcbuffer;
2135 __Pyx_Buf_DimInfo diminfo[8];
2136 } __Pyx_LocalBuf_ND;
2139 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2142 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2143 __Pyx_memviewslice *slice2,
2144 int ndim,
size_t itemsize);
2147 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2150 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2153 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2154 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2155 __Pyx_BufFmt_StackElem* stack,
2156 __Pyx_TypeInfo* type);
2159 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2162 static int __Pyx_ValidateAndInit_memviewslice(
2167 __Pyx_TypeInfo *dtype,
2168 __Pyx_BufFmt_StackElem stack[],
2169 __Pyx_memviewslice *memviewslice,
2170 PyObject *original_obj);
2173 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *,
int writable_flag);
2176 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(PyObject *,
int writable_flag);
2179 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value);
2182 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2187 #define __Pyx_CREAL(z) ((z).real()) 2188 #define __Pyx_CIMAG(z) ((z).imag()) 2190 #define __Pyx_CREAL(z) (__real__(z)) 2191 #define __Pyx_CIMAG(z) (__imag__(z)) 2194 #define __Pyx_CREAL(z) ((z).real) 2195 #define __Pyx_CIMAG(z) ((z).imag) 2197 #if defined(__cplusplus) && CYTHON_CCOMPLEX\ 2198 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) 2199 #define __Pyx_SET_CREAL(z,x) ((z).real(x)) 2200 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) 2202 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) 2203 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) 2208 #define __Pyx_c_eq_float(a, b) ((a)==(b)) 2209 #define __Pyx_c_sum_float(a, b) ((a)+(b)) 2210 #define __Pyx_c_diff_float(a, b) ((a)-(b)) 2211 #define __Pyx_c_prod_float(a, b) ((a)*(b)) 2212 #define __Pyx_c_quot_float(a, b) ((a)/(b)) 2213 #define __Pyx_c_neg_float(a) (-(a)) 2215 #define __Pyx_c_is_zero_float(z) ((z)==(float)0) 2216 #define __Pyx_c_conj_float(z) (::std::conj(z)) 2218 #define __Pyx_c_abs_float(z) (::std::abs(z)) 2219 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) 2222 #define __Pyx_c_is_zero_float(z) ((z)==0) 2223 #define __Pyx_c_conj_float(z) (conjf(z)) 2225 #define __Pyx_c_abs_float(z) (cabsf(z)) 2226 #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) 2230 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2231 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2232 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2233 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2234 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2235 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2236 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2237 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2239 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2240 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2246 #define __Pyx_c_eq_double(a, b) ((a)==(b)) 2247 #define __Pyx_c_sum_double(a, b) ((a)+(b)) 2248 #define __Pyx_c_diff_double(a, b) ((a)-(b)) 2249 #define __Pyx_c_prod_double(a, b) ((a)*(b)) 2250 #define __Pyx_c_quot_double(a, b) ((a)/(b)) 2251 #define __Pyx_c_neg_double(a) (-(a)) 2253 #define __Pyx_c_is_zero_double(z) ((z)==(double)0) 2254 #define __Pyx_c_conj_double(z) (::std::conj(z)) 2256 #define __Pyx_c_abs_double(z) (::std::abs(z)) 2257 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) 2260 #define __Pyx_c_is_zero_double(z) ((z)==0) 2261 #define __Pyx_c_conj_double(z) (conj(z)) 2263 #define __Pyx_c_abs_double(z) (cabs(z)) 2264 #define __Pyx_c_pow_double(a, b) (cpow(a, b)) 2268 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2269 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2270 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2271 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2272 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2273 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2274 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2275 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2277 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2278 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2283 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(
enum NPY_TYPES value);
2286 static __Pyx_memviewslice
2287 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2288 const char *mode,
int ndim,
2289 size_t sizeof_dtype,
int contig_flag,
2290 int dtype_is_object);
2293 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2296 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *);
2299 static CYTHON_INLINE
size_t __Pyx_PyInt_As_size_t(PyObject *);
2302 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2305 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2308 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2311 static int __Pyx_check_binary_version(
void);
2314 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2316 static PyObject *__pyx_f_15superluWrappers_12SparseFactor__set_mat_types(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2317 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2318 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2319 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2320 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2321 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2322 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2323 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2324 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2325 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2326 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2337 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2350 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2351 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2352 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2353 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2354 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2355 static CYTHON_INLINE
char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *,
char *,
char *,
int *);
2364 static PyTypeObject *__pyx_ptype_15superluWrappers_cSparseMatrix = 0;
2365 static PyTypeObject *__pyx_ptype_15superluWrappers_SparseFactor = 0;
2366 static PyTypeObject *__pyx_array_type = 0;
2367 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2368 static PyTypeObject *__pyx_memoryview_type = 0;
2369 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2370 static PyObject *
generic = 0;
2371 static PyObject *strided = 0;
2372 static PyObject *indirect = 0;
2373 static PyObject *contiguous = 0;
2374 static PyObject *indirect_contiguous = 0;
2375 static int __pyx_memoryview_thread_locks_used;
2376 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2377 static void __pyx_f_15superluWrappers_SparseMatrix_matvec(
struct __pyx_obj_15superluWrappers_cSparseMatrix *, __Pyx_memviewslice, __Pyx_memviewslice);
2378 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(
struct __pyx_obj_15superluWrappers_cSparseMatrix *,
struct __pyx_obj_15superluWrappers_SparseFactor *);
2379 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(
struct __pyx_obj_15superluWrappers_SparseFactor *, __Pyx_memviewslice);
2380 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2381 static void *__pyx_align_pointer(
void *,
size_t);
2382 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2383 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2384 static PyObject *_unellipsify(PyObject *,
int);
2385 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2386 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2387 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2388 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2389 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2390 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2391 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2392 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2393 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2394 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2395 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2396 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2397 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2398 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2399 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2400 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2401 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2402 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2403 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2404 static int __pyx_memoryview_err(PyObject *,
char *);
2405 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2406 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2407 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2408 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2409 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2410 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2411 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2412 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2413 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = {
"float64_t", NULL,
sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0,
'R', 0, 0 };
2414 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = {
"int32_t", NULL,
sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ?
'U' :
'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
2415 #define __Pyx_MODULE_NAME "superluWrappers" 2416 extern int __pyx_module_is_main_superluWrappers;
2417 int __pyx_module_is_main_superluWrappers = 0;
2420 static PyObject *__pyx_builtin_object;
2421 static PyObject *__pyx_builtin_open;
2422 static PyObject *__pyx_builtin_range;
2423 static PyObject *__pyx_builtin_TypeError;
2424 static PyObject *__pyx_builtin_ValueError;
2425 static PyObject *__pyx_builtin_RuntimeError;
2426 static PyObject *__pyx_builtin_ImportError;
2427 static PyObject *__pyx_builtin_MemoryError;
2428 static PyObject *__pyx_builtin_enumerate;
2429 static PyObject *__pyx_builtin_Ellipsis;
2430 static PyObject *__pyx_builtin_id;
2431 static PyObject *__pyx_builtin_IndexError;
2432 static const char __pyx_k_O[] =
"O";
2433 static const char __pyx_k_c[] =
"c";
2434 static const char __pyx_k_i[] =
"i";
2435 static const char __pyx_k_k[] =
"k";
2436 static const char __pyx_k_w[] =
"w";
2437 static const char __pyx_k_x[] =
"x";
2438 static const char __pyx_k_y[] =
"y";
2439 static const char __pyx_k_id[] =
"id";
2440 static const char __pyx_k_nc[] =
"nc";
2441 static const char __pyx_k_np[] =
"np";
2442 static const char __pyx_k_nr[] =
"nr";
2443 static const char __pyx_k_dim[] =
"dim";
2444 static const char __pyx_k_doc[] =
"__doc__";
2445 static const char __pyx_k_new[] =
"__new__";
2446 static const char __pyx_k_nnz[] =
"nnz";
2447 static const char __pyx_k_obj[] =
"obj";
2448 static const char __pyx_k_base[] =
"base";
2449 static const char __pyx_k_dict[] =
"__dict__";
2450 static const char __pyx_k_exit[] =
"__exit__";
2451 static const char __pyx_k_init[] =
"__init__";
2452 static const char __pyx_k_main[] =
"__main__";
2453 static const char __pyx_k_mode[] =
"mode";
2454 static const char __pyx_k_name[] =
"name";
2455 static const char __pyx_k_ndim[] =
"ndim";
2456 static const char __pyx_k_open[] =
"open";
2457 static const char __pyx_k_pack[] =
"pack";
2458 static const char __pyx_k_rows[] =
"_rows";
2459 static const char __pyx_k_self[] =
"self";
2460 static const char __pyx_k_size[] =
"size";
2461 static const char __pyx_k_step[] =
"step";
2462 static const char __pyx_k_stop[] =
"stop";
2463 static const char __pyx_k_test[] =
"__test__";
2464 static const char __pyx_k_ASCII[] =
"ASCII";
2465 static const char __pyx_k_class[] =
"__class__";
2466 static const char __pyx_k_enter[] =
"__enter__";
2467 static const char __pyx_k_error[] =
"error";
2468 static const char __pyx_k_flags[] =
"flags";
2469 static const char __pyx_k_i_i_i[] =
"%i %i %i \n";
2470 static const char __pyx_k_numpy[] =
"numpy";
2471 static const char __pyx_k_nzval[] =
"nzval";
2472 static const char __pyx_k_range[] =
"range";
2473 static const char __pyx_k_shape[] =
"shape";
2474 static const char __pyx_k_start[] =
"start";
2475 static const char __pyx_k_write[] =
"write";
2476 static const char __pyx_k_colind[] =
"colind";
2477 static const char __pyx_k_encode[] =
"encode";
2478 static const char __pyx_k_format[] =
"format";
2479 static const char __pyx_k_fwrite[] =
"fwrite";
2480 static const char __pyx_k_import[] =
"__import__";
2481 static const char __pyx_k_matvec[] =
"matvec";
2482 static const char __pyx_k_module[] =
"__module__";
2483 static const char __pyx_k_name_2[] =
"__name__";
2484 static const char __pyx_k_nzvals[] =
"nzvals";
2485 static const char __pyx_k_object[] =
"object";
2486 static const char __pyx_k_pickle[] =
"pickle";
2487 static const char __pyx_k_reduce[] =
"__reduce__";
2488 static const char __pyx_k_rowptr[] =
"rowptr";
2489 static const char __pyx_k_struct[] =
"struct";
2490 static const char __pyx_k_unpack[] =
"unpack";
2491 static const char __pyx_k_update[] =
"update";
2492 static const char __pyx_k_fortran[] =
"fortran";
2493 static const char __pyx_k_memview[] =
"memview";
2494 static const char __pyx_k_prepare[] =
"__prepare__";
2495 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2496 static const char __pyx_k_filename[] =
"filename";
2497 static const char __pyx_k_getstate[] =
"__getstate__";
2498 static const char __pyx_k_itemsize[] =
"itemsize";
2499 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2500 static const char __pyx_k_qualname[] =
"__qualname__";
2501 static const char __pyx_k_setstate[] =
"__setstate__";
2502 static const char __pyx_k_TypeError[] =
"TypeError";
2503 static const char __pyx_k_d_d_13_8e[] =
"%d %d %13.8e\n";
2504 static const char __pyx_k_enumerate[] =
"enumerate";
2505 static const char __pyx_k_metaclass[] =
"__metaclass__";
2506 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2507 static const char __pyx_k_range_end[] =
"range_end";
2508 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2509 static const char __pyx_k_IndexError[] =
"IndexError";
2510 static const char __pyx_k_ValueError[] =
"ValueError";
2511 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2512 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2513 static const char __pyx_k_ImportError[] =
"ImportError";
2514 static const char __pyx_k_MemoryError[] =
"MemoryError";
2515 static const char __pyx_k_PickleError[] =
"PickleError";
2516 static const char __pyx_k_output_file[] =
"output_file";
2517 static const char __pyx_k_range_start[] =
"range_start";
2518 static const char __pyx_k_RuntimeError[] =
"RuntimeError";
2519 static const char __pyx_k_SparseFactor[] =
"SparseFactor";
2520 static const char __pyx_k_SparseMatrix[] =
"SparseMatrix";
2521 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2522 static const char __pyx_k_sparseFactor[] =
"sparseFactor";
2523 static const char __pyx_k_stringsource[] =
"stringsource";
2524 static const char __pyx_k_cSparseMatrix[] =
"_cSparseMatrix";
2525 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2526 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2527 static const char __pyx_k_sparse_matrix[] =
"sparse_matrix";
2528 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2529 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2530 static const char __pyx_k_cSparseMatrix_2[] =
"cSparseMatrix";
2531 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2532 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2533 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2534 static const char __pyx_k_superluWrappers[] =
"superluWrappers";
2535 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2536 static const char __pyx_k_sparseFactorSolve[] =
"sparseFactorSolve";
2537 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2538 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2539 static const char __pyx_k_SparseMatrix___init[] =
"SparseMatrix.__init__";
2540 static const char __pyx_k_SparseMatrix_fwrite[] =
"SparseMatrix.fwrite";
2541 static const char __pyx_k_SparseMatrix_matvec[] =
"SparseMatrix.matvec";
2542 static const char __pyx_k_sparseFactorPrepare[] =
"sparseFactorPrepare";
2543 static const char __pyx_k_getCSRrepresentation[] =
"getCSRrepresentation";
2544 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2545 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2546 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2547 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2548 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2549 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2550 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2551 static const char __pyx_k_getSubMatCSRrepresentation[] =
"getSubMatCSRrepresentation";
2552 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2553 static const char __pyx_k_ndarray_is_not_C_contiguous[] =
"ndarray is not C contiguous";
2554 static const char __pyx_k_proteus_superluWrappers_pyx[] =
"proteus/superluWrappers.pyx";
2555 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2556 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2557 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
2558 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] =
"unknown dtype code in numpy.pxd (%d)";
2559 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2560 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2561 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2562 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2563 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2564 static const char __pyx_k_Format_string_allocated_too_shor[] =
"Format string allocated too short, see comment in numpy.pxd";
2565 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] =
"Incompatible checksums (%s vs 0xb068931 = (name))";
2566 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2567 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2568 static const char __pyx_k_Non_native_byte_order_not_suppor[] =
"Non-native byte order not supported";
2569 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2570 static const char __pyx_k_SparseMatrix_getCSRrepresentatio[] =
"SparseMatrix.getCSRrepresentation";
2571 static const char __pyx_k_SparseMatrix_getSubMatCSRreprese[] =
"SparseMatrix.getSubMatCSRrepresentation";
2572 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2573 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2574 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] =
"ndarray is not Fortran contiguous";
2575 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2576 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
2577 static const char __pyx_k_self_A_self_AC_self_L_self_U_sel[] =
"self.A,self.AC,self.L,self.U,self.X,self.etree,self.perm_c,self.perm_r,self.storeA,self.storeX cannot be converted to a Python object for pickling";
2578 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2579 static const char __pyx_k_Format_string_allocated_too_shor_2[] =
"Format string allocated too short.";
2580 static PyObject *__pyx_n_s_ASCII;
2581 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2582 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2583 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2584 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2585 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2586 static PyObject *__pyx_n_s_Ellipsis;
2587 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2588 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2589 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2590 static PyObject *__pyx_n_s_ImportError;
2591 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2592 static PyObject *__pyx_n_s_IndexError;
2593 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2594 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2595 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2596 static PyObject *__pyx_n_s_MemoryError;
2597 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2598 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2599 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
2600 static PyObject *__pyx_n_b_O;
2601 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2602 static PyObject *__pyx_n_s_PickleError;
2603 static PyObject *__pyx_n_s_RuntimeError;
2604 static PyObject *__pyx_n_s_SparseFactor;
2605 static PyObject *__pyx_n_s_SparseMatrix;
2606 static PyObject *__pyx_n_s_SparseMatrix___init;
2607 static PyObject *__pyx_n_s_SparseMatrix_fwrite;
2608 static PyObject *__pyx_n_s_SparseMatrix_getCSRrepresentatio;
2609 static PyObject *__pyx_n_s_SparseMatrix_getSubMatCSRreprese;
2610 static PyObject *__pyx_n_s_SparseMatrix_matvec;
2611 static PyObject *__pyx_n_s_TypeError;
2612 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2613 static PyObject *__pyx_n_s_ValueError;
2614 static PyObject *__pyx_n_s_View_MemoryView;
2615 static PyObject *__pyx_n_s_allocate_buffer;
2616 static PyObject *__pyx_n_s_base;
2617 static PyObject *__pyx_n_s_c;
2618 static PyObject *__pyx_n_u_c;
2619 static PyObject *__pyx_n_s_cSparseMatrix;
2620 static PyObject *__pyx_n_s_cSparseMatrix_2;
2621 static PyObject *__pyx_n_s_class;
2622 static PyObject *__pyx_n_s_cline_in_traceback;
2623 static PyObject *__pyx_n_s_colind;
2624 static PyObject *__pyx_kp_s_contiguous_and_direct;
2625 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2626 static PyObject *__pyx_kp_s_d_d_13_8e;
2627 static PyObject *__pyx_n_s_dict;
2628 static PyObject *__pyx_n_s_dim;
2629 static PyObject *__pyx_n_s_doc;
2630 static PyObject *__pyx_n_s_dtype_is_object;
2631 static PyObject *__pyx_n_s_encode;
2632 static PyObject *__pyx_n_s_enter;
2633 static PyObject *__pyx_n_s_enumerate;
2634 static PyObject *__pyx_n_s_error;
2635 static PyObject *__pyx_n_s_exit;
2636 static PyObject *__pyx_n_s_filename;
2637 static PyObject *__pyx_n_s_flags;
2638 static PyObject *__pyx_n_s_format;
2639 static PyObject *__pyx_n_s_fortran;
2640 static PyObject *__pyx_n_u_fortran;
2641 static PyObject *__pyx_n_s_fwrite;
2642 static PyObject *__pyx_n_s_getCSRrepresentation;
2643 static PyObject *__pyx_n_s_getSubMatCSRrepresentation;
2644 static PyObject *__pyx_n_s_getstate;
2645 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2646 static PyObject *__pyx_n_s_i;
2647 static PyObject *__pyx_kp_s_i_i_i;
2648 static PyObject *__pyx_n_s_id;
2649 static PyObject *__pyx_n_s_import;
2650 static PyObject *__pyx_n_s_init;
2651 static PyObject *__pyx_n_s_itemsize;
2652 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2653 static PyObject *__pyx_n_s_k;
2654 static PyObject *__pyx_n_s_main;
2655 static PyObject *__pyx_n_s_matvec;
2656 static PyObject *__pyx_n_s_memview;
2657 static PyObject *__pyx_n_s_metaclass;
2658 static PyObject *__pyx_n_s_mode;
2659 static PyObject *__pyx_n_s_module;
2660 static PyObject *__pyx_n_s_name;
2661 static PyObject *__pyx_n_s_name_2;
2662 static PyObject *__pyx_n_s_nc;
2663 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2664 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2665 static PyObject *__pyx_n_s_ndim;
2666 static PyObject *__pyx_n_s_new;
2667 static PyObject *__pyx_n_s_nnz;
2668 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2669 static PyObject *__pyx_n_s_np;
2670 static PyObject *__pyx_n_s_nr;
2671 static PyObject *__pyx_n_s_numpy;
2672 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2673 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2674 static PyObject *__pyx_n_s_nzval;
2675 static PyObject *__pyx_n_s_nzvals;
2676 static PyObject *__pyx_n_s_obj;
2677 static PyObject *__pyx_n_s_object;
2678 static PyObject *__pyx_n_s_open;
2679 static PyObject *__pyx_n_s_output_file;
2680 static PyObject *__pyx_n_s_pack;
2681 static PyObject *__pyx_n_s_pickle;
2682 static PyObject *__pyx_n_s_prepare;
2683 static PyObject *__pyx_kp_s_proteus_superluWrappers_pyx;
2684 static PyObject *__pyx_n_s_pyx_PickleError;
2685 static PyObject *__pyx_n_s_pyx_checksum;
2686 static PyObject *__pyx_n_s_pyx_getbuffer;
2687 static PyObject *__pyx_n_s_pyx_result;
2688 static PyObject *__pyx_n_s_pyx_state;
2689 static PyObject *__pyx_n_s_pyx_type;
2690 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2691 static PyObject *__pyx_n_s_pyx_vtable;
2692 static PyObject *__pyx_n_s_qualname;
2693 static PyObject *__pyx_n_s_range;
2694 static PyObject *__pyx_n_s_range_end;
2695 static PyObject *__pyx_n_s_range_start;
2696 static PyObject *__pyx_n_s_reduce;
2697 static PyObject *__pyx_n_s_reduce_cython;
2698 static PyObject *__pyx_n_s_reduce_ex;
2699 static PyObject *__pyx_n_s_rowptr;
2700 static PyObject *__pyx_n_s_rows;
2701 static PyObject *__pyx_n_s_self;
2702 static PyObject *__pyx_kp_s_self_A_self_AC_self_L_self_U_sel;
2703 static PyObject *__pyx_n_s_setstate;
2704 static PyObject *__pyx_n_s_setstate_cython;
2705 static PyObject *__pyx_n_s_shape;
2706 static PyObject *__pyx_n_s_size;
2707 static PyObject *__pyx_n_s_sparseFactor;
2708 static PyObject *__pyx_n_s_sparseFactorPrepare;
2709 static PyObject *__pyx_n_s_sparseFactorSolve;
2710 static PyObject *__pyx_n_s_sparse_matrix;
2711 static PyObject *__pyx_n_s_start;
2712 static PyObject *__pyx_n_s_step;
2713 static PyObject *__pyx_n_s_stop;
2714 static PyObject *__pyx_kp_s_strided_and_direct;
2715 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2716 static PyObject *__pyx_kp_s_strided_and_indirect;
2717 static PyObject *__pyx_kp_s_stringsource;
2718 static PyObject *__pyx_n_s_struct;
2719 static PyObject *__pyx_n_s_superluWrappers;
2720 static PyObject *__pyx_n_s_test;
2721 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2722 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2723 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2724 static PyObject *__pyx_n_s_unpack;
2725 static PyObject *__pyx_n_s_update;
2726 static PyObject *__pyx_n_s_w;
2727 static PyObject *__pyx_n_s_write;
2728 static PyObject *__pyx_n_s_x;
2729 static PyObject *__pyx_n_s_y;
2730 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nr, PyObject *__pyx_v_nc, PyObject *__pyx_v_nnz, PyObject *__pyx_v_nzvals, PyObject *__pyx_v_colind, PyObject *__pyx_v_rowptr);
2731 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_2matvec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y);
2732 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_base);
2733 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self);
2734 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_range_start, PyObject *__pyx_v_range_end);
2735 static int __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self,
int __pyx_v_nr,
int __pyx_v_nc,
int __pyx_v_nnz, __Pyx_memviewslice __pyx_v_nzval, __Pyx_memviewslice __pyx_v_colind, __Pyx_memviewslice __pyx_v_rowptr);
2736 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self);
2737 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2738 static int __pyx_pf_15superluWrappers_12SparseFactor___init__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_dim);
2739 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2740 static int __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_value);
2741 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self);
2742 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2743 static PyObject *__pyx_pf_15superluWrappers_sparseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparse_matrix, PyObject *__pyx_v_sparseFactor);
2744 static PyObject *__pyx_pf_15superluWrappers_2sparseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparseFactor, PyObject *__pyx_v_x);
2745 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2746 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info);
2747 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
2748 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2749 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2750 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2751 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2752 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2753 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2754 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
2755 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2756 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2757 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2758 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2759 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2760 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2761 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
2762 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2763 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2764 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2765 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2766 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2767 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2768 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2769 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2770 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2771 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2772 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2773 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2774 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2775 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2776 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2777 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2778 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2779 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2780 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2781 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2782 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2783 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2784 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2785 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2786 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2787 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2788 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
2789 static PyObject *__pyx_tp_new_15superluWrappers_cSparseMatrix(PyTypeObject *t, PyObject *a, PyObject *k);
2790 static PyObject *__pyx_tp_new_15superluWrappers_SparseFactor(PyTypeObject *t, PyObject *a, PyObject *k);
2791 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2792 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2793 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2794 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2795 static PyObject *__pyx_int_0;
2796 static PyObject *__pyx_int_1;
2797 static PyObject *__pyx_int_184977713;
2798 static PyObject *__pyx_int_neg_1;
2799 static PyObject *__pyx_tuple_;
2800 static PyObject *__pyx_tuple__2;
2801 static PyObject *__pyx_tuple__3;
2802 static PyObject *__pyx_tuple__4;
2803 static PyObject *__pyx_tuple__5;
2804 static PyObject *__pyx_tuple__6;
2805 static PyObject *__pyx_tuple__7;
2806 static PyObject *__pyx_tuple__8;
2807 static PyObject *__pyx_tuple__9;
2808 static PyObject *__pyx_slice__27;
2809 static PyObject *__pyx_tuple__10;
2810 static PyObject *__pyx_tuple__11;
2811 static PyObject *__pyx_tuple__12;
2812 static PyObject *__pyx_tuple__13;
2813 static PyObject *__pyx_tuple__14;
2814 static PyObject *__pyx_tuple__15;
2815 static PyObject *__pyx_tuple__16;
2816 static PyObject *__pyx_tuple__17;
2817 static PyObject *__pyx_tuple__18;
2818 static PyObject *__pyx_tuple__19;
2819 static PyObject *__pyx_tuple__20;
2820 static PyObject *__pyx_tuple__21;
2821 static PyObject *__pyx_tuple__22;
2822 static PyObject *__pyx_tuple__23;
2823 static PyObject *__pyx_tuple__24;
2824 static PyObject *__pyx_tuple__25;
2825 static PyObject *__pyx_tuple__26;
2826 static PyObject *__pyx_tuple__28;
2827 static PyObject *__pyx_tuple__29;
2828 static PyObject *__pyx_tuple__30;
2829 static PyObject *__pyx_tuple__31;
2830 static PyObject *__pyx_tuple__32;
2831 static PyObject *__pyx_tuple__34;
2832 static PyObject *__pyx_tuple__36;
2833 static PyObject *__pyx_tuple__38;
2834 static PyObject *__pyx_tuple__40;
2835 static PyObject *__pyx_tuple__42;
2836 static PyObject *__pyx_tuple__44;
2837 static PyObject *__pyx_tuple__46;
2838 static PyObject *__pyx_tuple__47;
2839 static PyObject *__pyx_tuple__48;
2840 static PyObject *__pyx_tuple__49;
2841 static PyObject *__pyx_tuple__50;
2842 static PyObject *__pyx_tuple__51;
2843 static PyObject *__pyx_codeobj__33;
2844 static PyObject *__pyx_codeobj__35;
2845 static PyObject *__pyx_codeobj__37;
2846 static PyObject *__pyx_codeobj__39;
2847 static PyObject *__pyx_codeobj__41;
2848 static PyObject *__pyx_codeobj__43;
2849 static PyObject *__pyx_codeobj__45;
2850 static PyObject *__pyx_codeobj__52;
2862 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2863 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_1__init__ = {
"__init__", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
2864 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2865 PyObject *__pyx_v_self = 0;
2866 PyObject *__pyx_v_nr = 0;
2867 PyObject *__pyx_v_nc = 0;
2868 PyObject *__pyx_v_nnz = 0;
2869 PyObject *__pyx_v_nzvals = 0;
2870 PyObject *__pyx_v_colind = 0;
2871 PyObject *__pyx_v_rowptr = 0;
2872 PyObject *__pyx_r = 0;
2873 __Pyx_RefNannyDeclarations
2874 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
2876 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_nr,&__pyx_n_s_nc,&__pyx_n_s_nnz,&__pyx_n_s_nzvals,&__pyx_n_s_colind,&__pyx_n_s_rowptr,0};
2877 PyObject* values[7] = {0,0,0,0,0,0,0};
2878 if (unlikely(__pyx_kwds)) {
2880 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2882 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2884 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2886 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2888 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2890 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2892 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2894 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2897 default:
goto __pyx_L5_argtuple_error;
2899 kw_args = PyDict_Size(__pyx_kwds);
2902 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2903 else goto __pyx_L5_argtuple_error;
2906 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr)) != 0)) kw_args--;
2908 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 1); __PYX_ERR(0, 15, __pyx_L3_error)
2912 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nc)) != 0)) kw_args--;
2914 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 2); __PYX_ERR(0, 15, __pyx_L3_error)
2918 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nnz)) != 0)) kw_args--;
2920 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 3); __PYX_ERR(0, 15, __pyx_L3_error)
2924 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nzvals)) != 0)) kw_args--;
2926 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 4); __PYX_ERR(0, 15, __pyx_L3_error)
2930 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
2932 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 5); __PYX_ERR(0, 15, __pyx_L3_error)
2936 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
2938 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, 6); __PYX_ERR(0, 15, __pyx_L3_error)
2941 if (unlikely(kw_args > 0)) {
2942 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
2944 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2945 goto __pyx_L5_argtuple_error;
2947 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2948 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2949 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2950 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2951 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2952 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2953 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2955 __pyx_v_self = values[0];
2956 __pyx_v_nr = values[1];
2957 __pyx_v_nc = values[2];
2958 __pyx_v_nnz = values[3];
2959 __pyx_v_nzvals = values[4];
2960 __pyx_v_colind = values[5];
2961 __pyx_v_rowptr = values[6];
2963 goto __pyx_L4_argument_unpacking_done;
2964 __pyx_L5_argtuple_error:;
2965 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 15, __pyx_L3_error)
2967 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2968 __Pyx_RefNannyFinishContext();
2970 __pyx_L4_argument_unpacking_done:;
2971 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix___init__(__pyx_self, __pyx_v_self, __pyx_v_nr, __pyx_v_nc, __pyx_v_nnz, __pyx_v_nzvals, __pyx_v_colind, __pyx_v_rowptr);
2974 __Pyx_RefNannyFinishContext();
2978 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_nr, PyObject *__pyx_v_nc, PyObject *__pyx_v_nnz, PyObject *__pyx_v_nzvals, PyObject *__pyx_v_colind, PyObject *__pyx_v_rowptr) {
2979 PyObject *__pyx_r = NULL;
2980 __Pyx_RefNannyDeclarations
2981 PyObject *__pyx_t_1 = NULL;
2982 PyObject *__pyx_t_2 = NULL;
2983 PyObject *__pyx_t_3 = NULL;
2984 PyObject *__pyx_t_4 = NULL;
2985 __Pyx_RefNannySetupContext(
"__init__", 0);
2994 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nr, __pyx_v_nr) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
2995 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nc, __pyx_v_nc) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
3004 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nnz, __pyx_v_nnz) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
3013 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
3014 __Pyx_GOTREF(__pyx_t_1);
3015 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nc);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
3016 __Pyx_GOTREF(__pyx_t_2);
3017 __pyx_t_3 = PyList_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
3018 __Pyx_GOTREF(__pyx_t_3);
3019 __Pyx_GIVEREF(__pyx_t_1);
3020 PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
3021 __Pyx_GIVEREF(__pyx_t_2);
3022 PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
3025 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
3026 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3035 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nzvals, __pyx_v_nzvals) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
3044 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_colind, __pyx_v_colind) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
3053 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rowptr, __pyx_v_rowptr) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
3062 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
3063 __Pyx_GOTREF(__pyx_t_3);
3072 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
3073 __Pyx_GOTREF(__pyx_t_2);
3082 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
3083 __Pyx_GOTREF(__pyx_t_1);
3092 __pyx_t_4 = PyTuple_New(6);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)
3093 __Pyx_GOTREF(__pyx_t_4);
3094 __Pyx_INCREF(__pyx_v_nr);
3095 __Pyx_GIVEREF(__pyx_v_nr);
3096 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_nr);
3097 __Pyx_INCREF(__pyx_v_nc);
3098 __Pyx_GIVEREF(__pyx_v_nc);
3099 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_nc);
3100 __Pyx_INCREF(__pyx_v_nnz);
3101 __Pyx_GIVEREF(__pyx_v_nnz);
3102 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nnz);
3103 __Pyx_GIVEREF(__pyx_t_3);
3104 PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
3105 __Pyx_GIVEREF(__pyx_t_2);
3106 PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
3107 __Pyx_GIVEREF(__pyx_t_1);
3108 PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_1);
3112 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_15superluWrappers_cSparseMatrix), __pyx_t_4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
3113 __Pyx_GOTREF(__pyx_t_1);
3114 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3115 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cSparseMatrix, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
3116 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3127 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3130 __Pyx_XDECREF(__pyx_t_1);
3131 __Pyx_XDECREF(__pyx_t_2);
3132 __Pyx_XDECREF(__pyx_t_3);
3133 __Pyx_XDECREF(__pyx_t_4);
3134 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3137 __Pyx_XGIVEREF(__pyx_r);
3138 __Pyx_RefNannyFinishContext();
3151 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_3matvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3152 static char __pyx_doc_15superluWrappers_12SparseMatrix_2matvec[] =
"\n Compute the sparse matrix-vector product y = Ax\n\n Arguments\n ---------\n x (input) : numpy array\n y (output) : numpy array\n ";
3153 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_3matvec = {
"matvec", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_3matvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_2matvec};
3154 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_3matvec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3155 PyObject *__pyx_v_self = 0;
3156 PyObject *__pyx_v_x = 0;
3157 PyObject *__pyx_v_y = 0;
3158 PyObject *__pyx_r = 0;
3159 __Pyx_RefNannyDeclarations
3160 __Pyx_RefNannySetupContext(
"matvec (wrapper)", 0);
3162 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_x,&__pyx_n_s_y,0};
3163 PyObject* values[3] = {0,0,0};
3164 if (unlikely(__pyx_kwds)) {
3166 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3168 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3170 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3172 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3175 default:
goto __pyx_L5_argtuple_error;
3177 kw_args = PyDict_Size(__pyx_kwds);
3180 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3181 else goto __pyx_L5_argtuple_error;
3184 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
3186 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, 1); __PYX_ERR(0, 35, __pyx_L3_error)
3190 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
3192 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, 2); __PYX_ERR(0, 35, __pyx_L3_error)
3195 if (unlikely(kw_args > 0)) {
3196 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"matvec") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
3198 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3199 goto __pyx_L5_argtuple_error;
3201 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3202 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3203 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3205 __pyx_v_self = values[0];
3206 __pyx_v_x = values[1];
3207 __pyx_v_y = values[2];
3209 goto __pyx_L4_argument_unpacking_done;
3210 __pyx_L5_argtuple_error:;
3211 __Pyx_RaiseArgtupleInvalid(
"matvec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
3213 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.matvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
3214 __Pyx_RefNannyFinishContext();
3216 __pyx_L4_argument_unpacking_done:;
3217 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_2matvec(__pyx_self, __pyx_v_self, __pyx_v_x, __pyx_v_y);
3220 __Pyx_RefNannyFinishContext();
3224 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_2matvec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
3225 PyObject *__pyx_r = NULL;
3226 __Pyx_RefNannyDeclarations
3227 PyObject *__pyx_t_1 = NULL;
3228 __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
3229 __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
3230 __Pyx_RefNannySetupContext(
"matvec", 0);
3239 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3240 __Pyx_GOTREF(__pyx_t_1);
3241 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 44, __pyx_L1_error)
3242 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_x, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3243 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_y, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 44, __pyx_L1_error)
3244 __pyx_f_15superluWrappers_SparseMatrix_matvec(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3);
3245 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3246 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
3247 __pyx_t_2.memview = NULL;
3248 __pyx_t_2.data = NULL;
3249 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
3250 __pyx_t_3.memview = NULL;
3251 __pyx_t_3.data = NULL;
3262 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3265 __Pyx_XDECREF(__pyx_t_1);
3266 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
3267 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
3268 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.matvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
3271 __Pyx_XGIVEREF(__pyx_r);
3272 __Pyx_RefNannyFinishContext();
3285 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3286 static char __pyx_doc_15superluWrappers_12SparseMatrix_4fwrite[] =
" Write the sparse matrix to a file\n\n Arguments\n ---------\n filename : str\n The output filename\n base : int\n ?!Possibly something to do with parallel?!\n ";
3287 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_5fwrite = {
"fwrite", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_4fwrite};
3288 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_5fwrite(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3289 PyObject *__pyx_v_self = 0;
3290 PyObject *__pyx_v_filename = 0;
3291 PyObject *__pyx_v_base = 0;
3292 PyObject *__pyx_r = 0;
3293 __Pyx_RefNannyDeclarations
3294 __Pyx_RefNannySetupContext(
"fwrite (wrapper)", 0);
3296 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filename,&__pyx_n_s_base,0};
3297 PyObject* values[3] = {0,0,0};
3298 if (unlikely(__pyx_kwds)) {
3300 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3302 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3304 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3306 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3309 default:
goto __pyx_L5_argtuple_error;
3311 kw_args = PyDict_Size(__pyx_kwds);
3314 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3315 else goto __pyx_L5_argtuple_error;
3318 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
3320 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, 1); __PYX_ERR(0, 46, __pyx_L3_error)
3324 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
3326 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, 2); __PYX_ERR(0, 46, __pyx_L3_error)
3329 if (unlikely(kw_args > 0)) {
3330 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"fwrite") < 0)) __PYX_ERR(0, 46, __pyx_L3_error)
3332 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3333 goto __pyx_L5_argtuple_error;
3335 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3336 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3337 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3339 __pyx_v_self = values[0];
3340 __pyx_v_filename = values[1];
3341 __pyx_v_base = values[2];
3343 goto __pyx_L4_argument_unpacking_done;
3344 __pyx_L5_argtuple_error:;
3345 __Pyx_RaiseArgtupleInvalid(
"fwrite", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 46, __pyx_L3_error)
3347 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3348 __Pyx_RefNannyFinishContext();
3350 __pyx_L4_argument_unpacking_done:;
3351 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(__pyx_self, __pyx_v_self, __pyx_v_filename, __pyx_v_base);
3354 __Pyx_RefNannyFinishContext();
3358 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_4fwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_base) {
3359 PyObject *__pyx_v_output_file = NULL;
3360 PyObject *__pyx_v_i = NULL;
3361 PyObject *__pyx_v_k = NULL;
3362 PyObject *__pyx_r = NULL;
3363 __Pyx_RefNannyDeclarations
3364 PyObject *__pyx_t_1 = NULL;
3365 PyObject *__pyx_t_2 = NULL;
3366 PyObject *__pyx_t_3 = NULL;
3367 PyObject *__pyx_t_4 = NULL;
3368 PyObject *__pyx_t_5 = NULL;
3369 PyObject *__pyx_t_6 = NULL;
3370 PyObject *__pyx_t_7 = NULL;
3371 PyObject *__pyx_t_8 = NULL;
3372 PyObject *__pyx_t_9 = NULL;
3373 PyObject *__pyx_t_10 = NULL;
3374 PyObject *__pyx_t_11 = NULL;
3375 Py_ssize_t __pyx_t_12;
3376 PyObject *(*__pyx_t_13)(PyObject *);
3377 Py_ssize_t __pyx_t_14;
3378 PyObject *(*__pyx_t_15)(PyObject *);
3379 PyObject *__pyx_t_16 = NULL;
3380 PyObject *__pyx_t_17 = NULL;
3383 __Pyx_RefNannySetupContext(
"fwrite", 0);
3393 __pyx_t_1 = PyTuple_New(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
3394 __Pyx_GOTREF(__pyx_t_1);
3395 __Pyx_INCREF(__pyx_v_filename);
3396 __Pyx_GIVEREF(__pyx_v_filename);
3397 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename);
3398 __Pyx_INCREF(__pyx_n_s_w);
3399 __Pyx_GIVEREF(__pyx_n_s_w);
3400 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_w);
3401 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
3402 __Pyx_GOTREF(__pyx_t_2);
3403 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3404 __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
3405 __Pyx_GOTREF(__pyx_t_3);
3406 __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L3_error)
3407 __Pyx_GOTREF(__pyx_t_4);
3409 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
3410 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
3411 if (likely(__pyx_t_5)) {
3412 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
3413 __Pyx_INCREF(__pyx_t_5);
3414 __Pyx_INCREF(
function);
3415 __Pyx_DECREF_SET(__pyx_t_4,
function);
3418 __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
3419 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3420 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L3_error)
3421 __Pyx_GOTREF(__pyx_t_1);
3422 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3423 __pyx_t_4 = __pyx_t_1;
3425 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3428 __Pyx_PyThreadState_declare
3429 __Pyx_PyThreadState_assign
3430 __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
3431 __Pyx_XGOTREF(__pyx_t_6);
3432 __Pyx_XGOTREF(__pyx_t_7);
3433 __Pyx_XGOTREF(__pyx_t_8);
3435 __pyx_v_output_file = __pyx_t_4;
3445 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_write);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L7_error)
3446 __Pyx_GOTREF(__pyx_t_2);
3447 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L7_error)
3448 __Pyx_GOTREF(__pyx_t_1);
3449 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nc);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L7_error)
3450 __Pyx_GOTREF(__pyx_t_5);
3451 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 57, __pyx_L7_error)
3452 __Pyx_GOTREF(__pyx_t_9);
3453 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L7_error)
3454 __Pyx_GOTREF(__pyx_t_10);
3455 __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_t_10);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L7_error)
3456 __Pyx_GOTREF(__pyx_t_11);
3457 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3458 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3459 __pyx_t_10 = PyTuple_New(3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 57, __pyx_L7_error)
3460 __Pyx_GOTREF(__pyx_t_10);
3461 __Pyx_GIVEREF(__pyx_t_1);
3462 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
3463 __Pyx_GIVEREF(__pyx_t_5);
3464 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
3465 __Pyx_GIVEREF(__pyx_t_11);
3466 PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_11);
3470 __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_i_i_i, __pyx_t_10);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 57, __pyx_L7_error)
3471 __Pyx_GOTREF(__pyx_t_11);
3472 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3474 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3475 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
3476 if (likely(__pyx_t_10)) {
3477 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
3478 __Pyx_INCREF(__pyx_t_10);
3479 __Pyx_INCREF(
function);
3480 __Pyx_DECREF_SET(__pyx_t_2,
function);
3483 __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11);
3484 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3485 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3486 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L7_error)
3487 __Pyx_GOTREF(__pyx_t_4);
3488 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3489 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3498 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L7_error)
3499 __Pyx_GOTREF(__pyx_t_4);
3500 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3501 __Pyx_GOTREF(__pyx_t_2);
3502 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3503 if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
3504 __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0;
3507 __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L7_error)
3508 __Pyx_GOTREF(__pyx_t_4);
3509 __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 58, __pyx_L7_error)
3511 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3513 if (likely(!__pyx_t_13)) {
3514 if (likely(PyList_CheckExact(__pyx_t_4))) {
3515 if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4))
break;
3516 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 3517 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L7_error)
3519 __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3520 __Pyx_GOTREF(__pyx_t_2);
3523 if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
3524 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 3525 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
if (unlikely(0 < 0)) __PYX_ERR(0, 58, __pyx_L7_error)
3527 __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L7_error)
3528 __Pyx_GOTREF(__pyx_t_2);
3532 __pyx_t_2 = __pyx_t_13(__pyx_t_4);
3533 if (unlikely(!__pyx_t_2)) {
3534 PyObject* exc_type = PyErr_Occurred();
3536 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3537 else __PYX_ERR(0, 58, __pyx_L7_error)
3541 __Pyx_GOTREF(__pyx_t_2);
3543 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
3553 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L7_error)
3554 __Pyx_GOTREF(__pyx_t_2);
3555 __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_i);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L7_error)
3556 __Pyx_GOTREF(__pyx_t_11);
3557 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3558 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L7_error)
3559 __Pyx_GOTREF(__pyx_t_2);
3560 __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3561 __Pyx_GOTREF(__pyx_t_10);
3562 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_10);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3563 __Pyx_GOTREF(__pyx_t_5);
3564 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3565 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3566 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3567 __Pyx_GOTREF(__pyx_t_10);
3568 __Pyx_GIVEREF(__pyx_t_11);
3569 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
3570 __Pyx_GIVEREF(__pyx_t_5);
3571 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
3574 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3575 __Pyx_GOTREF(__pyx_t_5);
3576 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3577 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
3578 __pyx_t_10 = __pyx_t_5; __Pyx_INCREF(__pyx_t_10); __pyx_t_14 = 0;
3581 __pyx_t_14 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_5);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L7_error)
3582 __Pyx_GOTREF(__pyx_t_10);
3583 __pyx_t_15 = Py_TYPE(__pyx_t_10)->tp_iternext;
if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 59, __pyx_L7_error)
3585 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3587 if (likely(!__pyx_t_15)) {
3588 if (likely(PyList_CheckExact(__pyx_t_10))) {
3589 if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_10))
break;
3590 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 3591 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++;
if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L7_error)
3593 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_14); __pyx_t_14++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3594 __Pyx_GOTREF(__pyx_t_5);
3597 if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_10))
break;
3598 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 3599 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++;
if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L7_error)
3601 __pyx_t_5 = PySequence_ITEM(__pyx_t_10, __pyx_t_14); __pyx_t_14++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L7_error)
3602 __Pyx_GOTREF(__pyx_t_5);
3606 __pyx_t_5 = __pyx_t_15(__pyx_t_10);
3607 if (unlikely(!__pyx_t_5)) {
3608 PyObject* exc_type = PyErr_Occurred();
3610 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3611 else __PYX_ERR(0, 59, __pyx_L7_error)
3615 __Pyx_GOTREF(__pyx_t_5);
3617 __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
3627 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_output_file, __pyx_n_s_write);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 60, __pyx_L7_error)
3628 __Pyx_GOTREF(__pyx_t_11);
3629 __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_v_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L7_error)
3630 __Pyx_GOTREF(__pyx_t_2);
3631 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L7_error)
3632 __Pyx_GOTREF(__pyx_t_1);
3633 __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_k);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3634 __Pyx_GOTREF(__pyx_t_9);
3635 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3636 __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_v_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L7_error)
3637 __Pyx_GOTREF(__pyx_t_1);
3638 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3639 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3640 __Pyx_GOTREF(__pyx_t_9);
3641 __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_v_k);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 60, __pyx_L7_error)
3642 __Pyx_GOTREF(__pyx_t_16);
3643 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3644 __pyx_t_9 = PyTuple_New(3);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L7_error)
3645 __Pyx_GOTREF(__pyx_t_9);
3646 __Pyx_GIVEREF(__pyx_t_2);
3647 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
3648 __Pyx_GIVEREF(__pyx_t_1);
3649 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
3650 __Pyx_GIVEREF(__pyx_t_16);
3651 PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_16);
3655 __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_d_d_13_8e, __pyx_t_9);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 60, __pyx_L7_error)
3656 __Pyx_GOTREF(__pyx_t_16);
3657 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3659 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
3660 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
3661 if (likely(__pyx_t_9)) {
3662 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_11);
3663 __Pyx_INCREF(__pyx_t_9);
3664 __Pyx_INCREF(
function);
3665 __Pyx_DECREF_SET(__pyx_t_11,
function);
3668 __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_16);
3669 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3670 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3671 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L7_error)
3672 __Pyx_GOTREF(__pyx_t_5);
3673 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3674 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3684 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3694 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3704 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3705 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3706 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
3707 goto __pyx_L12_try_end;
3709 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3710 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3711 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
3712 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
3713 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3714 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3715 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3716 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
3718 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3719 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_5) < 0) __PYX_ERR(0, 56, __pyx_L9_except_error)
3720 __Pyx_GOTREF(__pyx_t_4);
3721 __Pyx_GOTREF(__pyx_t_10);
3722 __Pyx_GOTREF(__pyx_t_5);
3723 __pyx_t_11 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_10, __pyx_t_5);
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L9_except_error)
3724 __Pyx_GOTREF(__pyx_t_11);
3725 __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL);
3726 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3727 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3728 if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 56, __pyx_L9_except_error)
3729 __Pyx_GOTREF(__pyx_t_17);
3730 __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_17);
3731 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
3732 if (__pyx_t_18 < 0) __PYX_ERR(0, 56, __pyx_L9_except_error)
3733 __pyx_t_19 = ((!(__pyx_t_18 != 0)) != 0);
3735 __Pyx_GIVEREF(__pyx_t_4);
3736 __Pyx_GIVEREF(__pyx_t_10);
3737 __Pyx_XGIVEREF(__pyx_t_5);
3738 __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_10, __pyx_t_5);
3739 __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_5 = 0;
3740 __PYX_ERR(0, 56, __pyx_L9_except_error)
3742 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3743 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
3744 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3745 goto __pyx_L8_exception_handled;
3747 __pyx_L9_except_error:;
3748 __Pyx_XGIVEREF(__pyx_t_6);
3749 __Pyx_XGIVEREF(__pyx_t_7);
3750 __Pyx_XGIVEREF(__pyx_t_8);
3751 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3752 goto __pyx_L1_error;
3753 __pyx_L8_exception_handled:;
3754 __Pyx_XGIVEREF(__pyx_t_6);
3755 __Pyx_XGIVEREF(__pyx_t_7);
3756 __Pyx_XGIVEREF(__pyx_t_8);
3757 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
3764 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, NULL);
3765 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3766 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
3767 __Pyx_GOTREF(__pyx_t_8);
3768 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3776 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3777 goto __pyx_L1_error;
3790 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3793 __Pyx_XDECREF(__pyx_t_1);
3794 __Pyx_XDECREF(__pyx_t_2);
3795 __Pyx_XDECREF(__pyx_t_4);
3796 __Pyx_XDECREF(__pyx_t_5);
3797 __Pyx_XDECREF(__pyx_t_9);
3798 __Pyx_XDECREF(__pyx_t_10);
3799 __Pyx_XDECREF(__pyx_t_11);
3800 __Pyx_XDECREF(__pyx_t_16);
3801 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.fwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
3804 __Pyx_XDECREF(__pyx_v_output_file);
3805 __Pyx_XDECREF(__pyx_v_i);
3806 __Pyx_XDECREF(__pyx_v_k);
3807 __Pyx_XGIVEREF(__pyx_r);
3808 __Pyx_RefNannyFinishContext();
3821 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_v_self);
3822 static char __pyx_doc_15superluWrappers_12SparseMatrix_6getCSRrepresentation[] =
" Get the CSR representation of the sparse matrix.\n\n Returns\n -------\n csr_data : tuple of nparray\n (rowptr, colptr, vals)\n ";
3823 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_7getCSRrepresentation = {
"getCSRrepresentation", (PyCFunction)__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation, METH_O, __pyx_doc_15superluWrappers_12SparseMatrix_6getCSRrepresentation};
3824 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_7getCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_v_self) {
3825 PyObject *__pyx_r = 0;
3826 __Pyx_RefNannyDeclarations
3827 __Pyx_RefNannySetupContext(
"getCSRrepresentation (wrapper)", 0);
3828 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(__pyx_self, ((PyObject *)__pyx_v_self));
3831 __Pyx_RefNannyFinishContext();
3835 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_6getCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
3836 PyObject *__pyx_r = NULL;
3837 __Pyx_RefNannyDeclarations
3838 PyObject *__pyx_t_1 = NULL;
3839 PyObject *__pyx_t_2 = NULL;
3840 PyObject *__pyx_t_3 = NULL;
3841 PyObject *__pyx_t_4 = NULL;
3842 __Pyx_RefNannySetupContext(
"getCSRrepresentation", 0);
3851 __Pyx_XDECREF(__pyx_r);
3852 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
3853 __Pyx_GOTREF(__pyx_t_1);
3854 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3855 __Pyx_GOTREF(__pyx_t_2);
3856 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
3857 __Pyx_GOTREF(__pyx_t_3);
3858 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
3859 __Pyx_GOTREF(__pyx_t_4);
3860 __Pyx_GIVEREF(__pyx_t_1);
3861 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3862 __Pyx_GIVEREF(__pyx_t_2);
3863 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
3864 __Pyx_GIVEREF(__pyx_t_3);
3865 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
3869 __pyx_r = __pyx_t_4;
3883 __Pyx_XDECREF(__pyx_t_1);
3884 __Pyx_XDECREF(__pyx_t_2);
3885 __Pyx_XDECREF(__pyx_t_3);
3886 __Pyx_XDECREF(__pyx_t_4);
3887 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
3890 __Pyx_XGIVEREF(__pyx_r);
3891 __Pyx_RefNannyFinishContext();
3904 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3905 static char __pyx_doc_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation[] =
" Get the CSR representation for a submatrix.\n\n Arguments\n ---------\n range_start : int\n range_end : int\n\n Returns\n -------\n csr_data : tuple of nparray\n (rowptr, colind, nzvals)\n ";
3906 static PyMethodDef __pyx_mdef_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation = {
"getSubMatCSRrepresentation", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation};
3907 static PyObject *__pyx_pw_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3908 PyObject *__pyx_v_self = 0;
3909 PyObject *__pyx_v_range_start = 0;
3910 PyObject *__pyx_v_range_end = 0;
3911 PyObject *__pyx_r = 0;
3912 __Pyx_RefNannyDeclarations
3913 __Pyx_RefNannySetupContext(
"getSubMatCSRrepresentation (wrapper)", 0);
3915 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_range_start,&__pyx_n_s_range_end,0};
3916 PyObject* values[3] = {0,0,0};
3917 if (unlikely(__pyx_kwds)) {
3919 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3921 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3923 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3925 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3928 default:
goto __pyx_L5_argtuple_error;
3930 kw_args = PyDict_Size(__pyx_kwds);
3933 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3934 else goto __pyx_L5_argtuple_error;
3937 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_start)) != 0)) kw_args--;
3939 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, 1); __PYX_ERR(0, 72, __pyx_L3_error)
3943 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_range_end)) != 0)) kw_args--;
3945 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, 2); __PYX_ERR(0, 72, __pyx_L3_error)
3948 if (unlikely(kw_args > 0)) {
3949 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"getSubMatCSRrepresentation") < 0)) __PYX_ERR(0, 72, __pyx_L3_error)
3951 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3952 goto __pyx_L5_argtuple_error;
3954 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3955 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3956 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3958 __pyx_v_self = values[0];
3959 __pyx_v_range_start = values[1];
3960 __pyx_v_range_end = values[2];
3962 goto __pyx_L4_argument_unpacking_done;
3963 __pyx_L5_argtuple_error:;
3964 __Pyx_RaiseArgtupleInvalid(
"getSubMatCSRrepresentation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 72, __pyx_L3_error)
3966 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getSubMatCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
3967 __Pyx_RefNannyFinishContext();
3969 __pyx_L4_argument_unpacking_done:;
3970 __pyx_r = __pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(__pyx_self, __pyx_v_self, __pyx_v_range_start, __pyx_v_range_end);
3973 __Pyx_RefNannyFinishContext();
3977 static PyObject *__pyx_pf_15superluWrappers_12SparseMatrix_8getSubMatCSRrepresentation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_range_start, PyObject *__pyx_v_range_end) {
3978 PyObject *__pyx_v__rows = NULL;
3979 PyObject *__pyx_v_nnz = NULL;
3980 PyObject *__pyx_v_rowptr = NULL;
3981 PyObject *__pyx_v_colind = NULL;
3982 PyObject *__pyx_v_nzvals = NULL;
3983 PyObject *__pyx_r = NULL;
3984 __Pyx_RefNannyDeclarations
3985 PyObject *__pyx_t_1 = NULL;
3987 PyObject *__pyx_t_3 = NULL;
3988 PyObject *__pyx_t_4 = NULL;
3989 PyObject *__pyx_t_5 = NULL;
3990 __Pyx_RefNannySetupContext(
"getSubMatCSRrepresentation", 0);
3999 #ifndef CYTHON_WITHOUT_ASSERTIONS 4000 if (unlikely(!Py_OptimizeFlag)) {
4001 __pyx_t_1 = PyObject_RichCompare(__pyx_v_range_start, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
4002 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
4003 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4004 if (unlikely(!__pyx_t_2)) {
4005 PyErr_SetNone(PyExc_AssertionError);
4006 __PYX_ERR(0, 87, __pyx_L1_error)
4010 #ifndef CYTHON_WITHOUT_ASSERTIONS 4011 if (unlikely(!Py_OptimizeFlag)) {
4012 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
4013 __Pyx_GOTREF(__pyx_t_1);
4014 __pyx_t_3 = PyObject_RichCompare(__pyx_v_range_end, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
4015 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4016 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 87, __pyx_L1_error)
4017 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4018 if (unlikely(!__pyx_t_2)) {
4019 PyErr_SetNone(PyExc_AssertionError);
4020 __PYX_ERR(0, 87, __pyx_L1_error)
4032 #ifndef CYTHON_WITHOUT_ASSERTIONS 4033 if (unlikely(!Py_OptimizeFlag)) {
4034 __pyx_t_3 = PyObject_RichCompare(__pyx_v_range_end, __pyx_v_range_start, Py_GT); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
4035 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 88, __pyx_L1_error)
4036 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4037 if (unlikely(!__pyx_t_2)) {
4038 PyErr_SetNone(PyExc_AssertionError);
4039 __PYX_ERR(0, 88, __pyx_L1_error)
4051 __pyx_t_3 = PyNumber_Subtract(__pyx_v_range_end, __pyx_v_range_start);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
4052 __Pyx_GOTREF(__pyx_t_3);
4053 __pyx_v__rows = __pyx_t_3;
4063 #ifndef CYTHON_WITHOUT_ASSERTIONS 4064 if (unlikely(!Py_OptimizeFlag)) {
4065 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
4066 __Pyx_GOTREF(__pyx_t_3);
4067 __pyx_t_1 = PyObject_RichCompare(__pyx_v__rows, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
4068 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4069 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
4070 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4071 if (unlikely(!__pyx_t_2)) {
4072 PyErr_SetNone(PyExc_AssertionError);
4073 __PYX_ERR(0, 90, __pyx_L1_error)
4085 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4086 __Pyx_GOTREF(__pyx_t_1);
4087 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_range_end);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
4088 __Pyx_GOTREF(__pyx_t_3);
4089 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4090 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4091 __Pyx_GOTREF(__pyx_t_1);
4092 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_range_start);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
4093 __Pyx_GOTREF(__pyx_t_4);
4094 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4095 __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
4096 __Pyx_GOTREF(__pyx_t_1);
4097 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4098 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4099 __pyx_v_nnz = __pyx_t_1;
4109 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
4110 __Pyx_GOTREF(__pyx_t_1);
4111 __pyx_t_4 = PyNumber_Add(__pyx_v_range_start, __pyx_v__rows);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
4112 __Pyx_GOTREF(__pyx_t_4);
4113 __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
4114 __Pyx_GOTREF(__pyx_t_3);
4115 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4116 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, &__pyx_v_range_start, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error)
4117 __Pyx_GOTREF(__pyx_t_4);
4118 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4119 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4120 __pyx_v_rowptr = __pyx_t_4;
4130 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_colind);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
4131 __Pyx_GOTREF(__pyx_t_4);
4132 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4133 __Pyx_GOTREF(__pyx_t_3);
4134 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
4135 __Pyx_GOTREF(__pyx_t_1);
4136 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4137 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4138 __Pyx_GOTREF(__pyx_t_3);
4139 __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
4140 __Pyx_GOTREF(__pyx_t_5);
4141 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4142 __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_v_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
4143 __Pyx_GOTREF(__pyx_t_3);
4144 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4145 __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, &__pyx_t_1, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
4146 __Pyx_GOTREF(__pyx_t_5);
4147 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4148 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4149 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4150 __pyx_v_colind = __pyx_t_5;
4160 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nzvals);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error)
4161 __Pyx_GOTREF(__pyx_t_5);
4162 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4163 __Pyx_GOTREF(__pyx_t_3);
4164 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
4165 __Pyx_GOTREF(__pyx_t_1);
4166 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4167 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rowptr);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4168 __Pyx_GOTREF(__pyx_t_3);
4169 __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_range_start);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
4170 __Pyx_GOTREF(__pyx_t_4);
4171 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4172 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4173 __Pyx_GOTREF(__pyx_t_3);
4174 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4175 __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 0, &__pyx_t_1, &__pyx_t_3, NULL, 0, 0, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
4176 __Pyx_GOTREF(__pyx_t_4);
4177 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4178 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4179 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4180 __pyx_v_nzvals = __pyx_t_4;
4190 __Pyx_XDECREF(__pyx_r);
4191 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
4192 __Pyx_GOTREF(__pyx_t_4);
4193 __Pyx_INCREF(__pyx_v_rowptr);
4194 __Pyx_GIVEREF(__pyx_v_rowptr);
4195 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_rowptr);
4196 __Pyx_INCREF(__pyx_v_colind);
4197 __Pyx_GIVEREF(__pyx_v_colind);
4198 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_colind);
4199 __Pyx_INCREF(__pyx_v_nzvals);
4200 __Pyx_GIVEREF(__pyx_v_nzvals);
4201 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_nzvals);
4202 __pyx_r = __pyx_t_4;
4216 __Pyx_XDECREF(__pyx_t_1);
4217 __Pyx_XDECREF(__pyx_t_3);
4218 __Pyx_XDECREF(__pyx_t_4);
4219 __Pyx_XDECREF(__pyx_t_5);
4220 __Pyx_AddTraceback(
"superluWrappers.SparseMatrix.getSubMatCSRrepresentation", __pyx_clineno, __pyx_lineno, __pyx_filename);
4223 __Pyx_XDECREF(__pyx_v__rows);
4224 __Pyx_XDECREF(__pyx_v_nnz);
4225 __Pyx_XDECREF(__pyx_v_rowptr);
4226 __Pyx_XDECREF(__pyx_v_colind);
4227 __Pyx_XDECREF(__pyx_v_nzvals);
4228 __Pyx_XGIVEREF(__pyx_r);
4229 __Pyx_RefNannyFinishContext();
4242 static int __pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4243 static int __pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4247 __Pyx_memviewslice __pyx_v_nzval = { 0, 0, { 0 }, { 0 }, { 0 } };
4248 __Pyx_memviewslice __pyx_v_colind = { 0, 0, { 0 }, { 0 }, { 0 } };
4249 __Pyx_memviewslice __pyx_v_rowptr = { 0, 0, { 0 }, { 0 }, { 0 } };
4251 __Pyx_RefNannyDeclarations
4252 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
4254 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nr,&__pyx_n_s_nc,&__pyx_n_s_nnz,&__pyx_n_s_nzval,&__pyx_n_s_colind,&__pyx_n_s_rowptr,0};
4255 PyObject* values[6] = {0,0,0,0,0,0};
4256 if (unlikely(__pyx_kwds)) {
4258 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4260 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4262 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4264 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4266 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4268 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4270 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4273 default:
goto __pyx_L5_argtuple_error;
4275 kw_args = PyDict_Size(__pyx_kwds);
4278 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr)) != 0)) kw_args--;
4279 else goto __pyx_L5_argtuple_error;
4282 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nc)) != 0)) kw_args--;
4284 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 1); __PYX_ERR(0, 102, __pyx_L3_error)
4288 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nnz)) != 0)) kw_args--;
4290 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 2); __PYX_ERR(0, 102, __pyx_L3_error)
4294 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nzval)) != 0)) kw_args--;
4296 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 3); __PYX_ERR(0, 102, __pyx_L3_error)
4300 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
4302 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 4); __PYX_ERR(0, 102, __pyx_L3_error)
4306 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
4308 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, 5); __PYX_ERR(0, 102, __pyx_L3_error)
4311 if (unlikely(kw_args > 0)) {
4312 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 102, __pyx_L3_error)
4314 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
4315 goto __pyx_L5_argtuple_error;
4317 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4318 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4319 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4320 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4321 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4322 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4324 __pyx_v_nr = __Pyx_PyInt_As_int(values[0]);
if (unlikely((__pyx_v_nr == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L3_error)
4325 __pyx_v_nc = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_nc == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error)
4326 __pyx_v_nnz = __Pyx_PyInt_As_int(values[2]);
if (unlikely((__pyx_v_nnz == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
4327 __pyx_v_nzval = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[3], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_nzval.memview)) __PYX_ERR(0, 106, __pyx_L3_error)
4328 __pyx_v_colind = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(values[4], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_colind.memview)) __PYX_ERR(0, 107, __pyx_L3_error)
4329 __pyx_v_rowptr = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(values[5], PyBUF_WRITABLE);
if (unlikely(!__pyx_v_rowptr.memview)) __PYX_ERR(0, 108, __pyx_L3_error)
4331 goto __pyx_L4_argument_unpacking_done;
4332 __pyx_L5_argtuple_error:;
4333 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 102, __pyx_L3_error)
4335 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4336 __Pyx_RefNannyFinishContext();
4338 __pyx_L4_argument_unpacking_done:;
4339 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self), __pyx_v_nr, __pyx_v_nc, __pyx_v_nnz, __pyx_v_nzval, __pyx_v_colind, __pyx_v_rowptr);
4342 __Pyx_RefNannyFinishContext();
4346 static int __pyx_pf_15superluWrappers_13cSparseMatrix___cinit__(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self,
int __pyx_v_nr,
int __pyx_v_nc,
int __pyx_v_nnz, __Pyx_memviewslice __pyx_v_nzval, __Pyx_memviewslice __pyx_v_colind, __Pyx_memviewslice __pyx_v_rowptr) {
4348 __Pyx_RefNannyDeclarations
4349 Py_ssize_t __pyx_t_1;
4350 Py_ssize_t __pyx_t_2;
4351 Py_ssize_t __pyx_t_3;
4352 __Pyx_RefNannySetupContext(
"__cinit__", 0);
4361 (__pyx_v_self->dim[0]) = __pyx_v_nr;
4362 (__pyx_v_self->dim[1]) = __pyx_v_nc;
4371 __pyx_v_self->A.nnz = __pyx_v_nnz;
4381 __pyx_v_self->A.nzval = (&(*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_nzval.data + __pyx_t_1 * __pyx_v_nzval.strides[0]) ))));
4391 __pyx_v_self->A.colind = (&(*((__pyx_t_5numpy_int32_t *) ( (__pyx_v_colind.data + __pyx_t_2 * __pyx_v_colind.strides[0]) ))));
4401 __pyx_v_self->A.rowptr = (&(*((__pyx_t_5numpy_int32_t *) ( (__pyx_v_rowptr.data + __pyx_t_3 * __pyx_v_rowptr.strides[0]) ))));
4413 __PYX_XDEC_MEMVIEW(&__pyx_v_nzval, 1);
4414 __PYX_XDEC_MEMVIEW(&__pyx_v_colind, 1);
4415 __PYX_XDEC_MEMVIEW(&__pyx_v_rowptr, 1);
4416 __Pyx_RefNannyFinishContext();
4427 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
4428 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4429 PyObject *__pyx_r = 0;
4430 __Pyx_RefNannyDeclarations
4431 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
4432 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self));
4435 __Pyx_RefNannyFinishContext();
4439 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self) {
4440 PyObject *__pyx_r = NULL;
4441 __Pyx_RefNannyDeclarations
4442 PyObject *__pyx_t_1 = NULL;
4443 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
4451 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4452 __Pyx_GOTREF(__pyx_t_1);
4453 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4454 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4455 __PYX_ERR(1, 2, __pyx_L1_error)
4465 __Pyx_XDECREF(__pyx_t_1);
4466 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4468 __Pyx_XGIVEREF(__pyx_r);
4469 __Pyx_RefNannyFinishContext();
4481 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
4482 static PyObject *__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4483 PyObject *__pyx_r = 0;
4484 __Pyx_RefNannyDeclarations
4485 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
4486 __pyx_r = __pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4489 __Pyx_RefNannyFinishContext();
4493 static PyObject *__pyx_pf_15superluWrappers_13cSparseMatrix_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4494 PyObject *__pyx_r = NULL;
4495 __Pyx_RefNannyDeclarations
4496 PyObject *__pyx_t_1 = NULL;
4497 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
4504 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4505 __Pyx_GOTREF(__pyx_t_1);
4506 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4507 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4508 __PYX_ERR(1, 4, __pyx_L1_error)
4519 __Pyx_XDECREF(__pyx_t_1);
4520 __Pyx_AddTraceback(
"superluWrappers.cSparseMatrix.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4522 __Pyx_XGIVEREF(__pyx_r);
4523 __Pyx_RefNannyFinishContext();
4535 static void __pyx_f_15superluWrappers_SparseMatrix_matvec(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_sm, __Pyx_memviewslice __pyx_v_xp, __Pyx_memviewslice __pyx_v_yp) {
4536 __pyx_t_5numpy_float64_t __pyx_v_tmp;
4539 __Pyx_RefNannyDeclarations
4540 __pyx_t_5numpy_int32_t __pyx_t_1;
4541 __pyx_t_5numpy_int32_t __pyx_t_2;
4543 __pyx_t_5numpy_int32_t __pyx_t_4;
4544 __pyx_t_5numpy_int32_t __pyx_t_5;
4546 Py_ssize_t __pyx_t_7;
4547 Py_ssize_t __pyx_t_8;
4548 __Pyx_RefNannySetupContext(
"SparseMatrix_matvec", 0);
4566 __pyx_t_1 = (__pyx_v_sm->dim[0]);
4567 __pyx_t_2 = __pyx_t_1;
4568 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4569 __pyx_v_i = __pyx_t_3;
4587 __pyx_t_4 = (__pyx_v_sm->A.rowptr[(__pyx_v_i + 1)]);
4588 __pyx_t_5 = __pyx_t_4;
4589 for (__pyx_t_6 = (__pyx_v_sm->A.rowptr[__pyx_v_i]); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4590 __pyx_v_k = __pyx_t_6;
4599 __pyx_t_7 = (__pyx_v_sm->A.colind[__pyx_v_k]);
4600 __pyx_v_tmp = (__pyx_v_tmp + ((__pyx_v_sm->A.nzval[__pyx_v_k]) * (*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_xp.data + __pyx_t_7 * __pyx_v_xp.strides[0]) )))));
4610 __pyx_t_8 = __pyx_v_i;
4611 *((__pyx_t_5numpy_float64_t *) ( (__pyx_v_yp.data + __pyx_t_8 * __pyx_v_yp.strides[0]) )) = __pyx_v_tmp;
4623 __Pyx_RefNannyFinishContext();
4635 static int __pyx_pw_15superluWrappers_12SparseFactor_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4636 static char __pyx_doc_15superluWrappers_12SparseFactor___init__[] =
"\n Arguments\n ---------\n dim : int\n Dimension of the sparse factor.\n ";
4637 #if CYTHON_COMPILING_IN_CPYTHON 4638 struct wrapperbase __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__;
4640 static int __pyx_pw_15superluWrappers_12SparseFactor_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4641 PyObject *__pyx_v_dim = 0;
4643 __Pyx_RefNannyDeclarations
4644 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
4646 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,0};
4647 PyObject* values[1] = {0};
4648 if (unlikely(__pyx_kwds)) {
4650 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4652 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4655 default:
goto __pyx_L5_argtuple_error;
4657 kw_args = PyDict_Size(__pyx_kwds);
4660 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim)) != 0)) kw_args--;
4661 else goto __pyx_L5_argtuple_error;
4663 if (unlikely(kw_args > 0)) {
4664 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 170, __pyx_L3_error)
4666 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4667 goto __pyx_L5_argtuple_error;
4669 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4671 __pyx_v_dim = values[0];
4673 goto __pyx_L4_argument_unpacking_done;
4674 __pyx_L5_argtuple_error:;
4675 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 170, __pyx_L3_error)
4677 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4678 __Pyx_RefNannyFinishContext();
4680 __pyx_L4_argument_unpacking_done:;
4681 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor___init__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), __pyx_v_dim);
4684 __Pyx_RefNannyFinishContext();
4688 static int __pyx_pf_15superluWrappers_12SparseFactor___init__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_dim) {
4690 __Pyx_RefNannyDeclarations
4691 PyObject *__pyx_t_1 = NULL;
4693 __pyx_t_5numpy_int32_t __pyx_t_3;
4694 PyObject *__pyx_t_4 = NULL;
4696 __Pyx_RefNannySetupContext(
"__init__", 0);
4705 StatInit((&__pyx_v_self->stat));
4714 set_default_options((&__pyx_v_self->options));
4723 __pyx_t_1 = ((
struct __pyx_vtabstruct_15superluWrappers_SparseFactor *)__pyx_v_self->__pyx_vtab)->_set_mat_types(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
4724 __Pyx_GOTREF(__pyx_t_1);
4725 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4734 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
4735 __pyx_v_self->dim = __pyx_t_2;
4744 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
4745 __pyx_v_self->A.nrow = __pyx_t_2;
4746 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error)
4747 __pyx_v_self->A.ncol = __pyx_t_2;
4756 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
4757 __pyx_v_self->AC.nrow = __pyx_t_2;
4758 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error)
4759 __pyx_v_self->AC.ncol = __pyx_t_2;
4768 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
4769 __pyx_v_self->L.nrow = __pyx_t_2;
4770 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L1_error)
4771 __pyx_v_self->L.ncol = __pyx_t_2;
4780 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
4781 __pyx_v_self->U.nrow = __pyx_t_2;
4782 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L1_error)
4783 __pyx_v_self->U.ncol = __pyx_t_2;
4792 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_dim);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error)
4793 __pyx_v_self->X.nrow = __pyx_t_2;
4794 __pyx_v_self->X.ncol = 1;
4803 __pyx_t_3 = __Pyx_PyInt_As_npy_int32(__pyx_v_dim);
if (unlikely((__pyx_t_3 == ((npy_int32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
4804 __pyx_v_self->storeX.lda = __pyx_t_3;
4813 __pyx_v_self->use_same_perm_c = 0;
4822 __pyx_v_self->use_same_sparsity = 0;
4831 __pyx_t_1 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
4832 __Pyx_GOTREF(__pyx_t_1);
4833 __pyx_t_4 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
4834 __Pyx_GOTREF(__pyx_t_4);
4835 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4836 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error)
4837 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4838 __pyx_v_self->perm_c = ((
int *)malloc(__pyx_t_5));
4847 __pyx_t_4 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error)
4848 __Pyx_GOTREF(__pyx_t_4);
4849 __pyx_t_1 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
4850 __Pyx_GOTREF(__pyx_t_1);
4851 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4852 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_1);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L1_error)
4853 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4854 __pyx_v_self->perm_r = ((
int *)malloc(__pyx_t_5));
4863 __pyx_t_1 = __Pyx_PyInt_FromSize_t((
sizeof(__pyx_t_5numpy_int32_t)));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
4864 __Pyx_GOTREF(__pyx_t_1);
4865 __pyx_t_4 = PyNumber_Multiply(__pyx_v_dim, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
4866 __Pyx_GOTREF(__pyx_t_4);
4867 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4868 __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error)
4869 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4870 __pyx_v_self->etree = ((
int *)malloc(__pyx_t_5));
4884 __Pyx_XDECREF(__pyx_t_1);
4885 __Pyx_XDECREF(__pyx_t_4);
4886 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4889 __Pyx_RefNannyFinishContext();
4901 static PyObject *__pyx_f_15superluWrappers_12SparseFactor__set_mat_types(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
4902 PyObject *__pyx_r = NULL;
4903 __Pyx_RefNannyDeclarations
4904 __Pyx_RefNannySetupContext(
"_set_mat_types", 0);
4913 __pyx_v_self->A.Stype = SLU_NC;
4922 __pyx_v_self->A.Dtype = SLU_D;
4931 __pyx_v_self->A.Mtype = SLU_GE;
4940 __pyx_v_self->A.Store = (&__pyx_v_self->storeA);
4949 __pyx_v_self->AC.Stype = SLU_NCP;
4958 __pyx_v_self->AC.Dtype = SLU_D;
4967 __pyx_v_self->AC.Mtype = SLU_GE;
4976 __pyx_v_self->AC.Store = NULL;
4985 __pyx_v_self->L.Stype = SLU_NC;
4994 __pyx_v_self->L.Dtype = SLU_D;
5003 __pyx_v_self->L.Mtype = SLU_TRLU;
5012 __pyx_v_self->L.Store = NULL;
5021 __pyx_v_self->U.Stype = SLU_NC;
5030 __pyx_v_self->U.Dtype = SLU_D;
5039 __pyx_v_self->U.Mtype = SLU_TRU;
5048 __pyx_v_self->U.Store = NULL;
5057 __pyx_v_self->X.Stype = SLU_DN;
5066 __pyx_v_self->X.Dtype = SLU_D;
5075 __pyx_v_self->X.Mtype = SLU_GE;
5084 __pyx_v_self->X.Store = (&__pyx_v_self->storeX);
5095 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5096 __Pyx_XGIVEREF(__pyx_r);
5097 __Pyx_RefNannyFinishContext();
5110 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(PyObject *__pyx_v_self);
5111 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(PyObject *__pyx_v_self) {
5112 PyObject *__pyx_r = 0;
5113 __Pyx_RefNannyDeclarations
5114 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
5115 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self));
5118 __Pyx_RefNannyFinishContext();
5122 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_3dim___get__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
5123 PyObject *__pyx_r = NULL;
5124 __Pyx_RefNannyDeclarations
5125 PyObject *__pyx_t_1 = NULL;
5126 __Pyx_RefNannySetupContext(
"__get__", 0);
5127 __Pyx_XDECREF(__pyx_r);
5128 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->dim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
5129 __Pyx_GOTREF(__pyx_t_1);
5130 __pyx_r = __pyx_t_1;
5136 __Pyx_XDECREF(__pyx_t_1);
5137 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.dim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5140 __Pyx_XGIVEREF(__pyx_r);
5141 __Pyx_RefNannyFinishContext();
5146 static int __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value);
5147 static int __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
5149 __Pyx_RefNannyDeclarations
5150 __Pyx_RefNannySetupContext(
"__set__ (wrapper)", 0);
5151 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), ((PyObject *)__pyx_v_value));
5154 __Pyx_RefNannyFinishContext();
5158 static int __pyx_pf_15superluWrappers_12SparseFactor_3dim_2__set__(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, PyObject *__pyx_v_value) {
5160 __Pyx_RefNannyDeclarations
5162 __Pyx_RefNannySetupContext(
"__set__", 0);
5163 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value);
if (unlikely((__pyx_t_1 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 168, __pyx_L1_error)
5164 __pyx_v_self->dim = __pyx_t_1;
5170 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.dim.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5173 __Pyx_RefNannyFinishContext();
5184 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
5185 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5186 PyObject *__pyx_r = 0;
5187 __Pyx_RefNannyDeclarations
5188 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
5189 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self));
5192 __Pyx_RefNannyFinishContext();
5196 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_2__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self) {
5197 PyObject *__pyx_r = NULL;
5198 __Pyx_RefNannyDeclarations
5199 PyObject *__pyx_t_1 = NULL;
5200 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
5208 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5209 __Pyx_GOTREF(__pyx_t_1);
5210 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5211 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5212 __PYX_ERR(1, 2, __pyx_L1_error)
5222 __Pyx_XDECREF(__pyx_t_1);
5223 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5225 __Pyx_XGIVEREF(__pyx_r);
5226 __Pyx_RefNannyFinishContext();
5238 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
5239 static PyObject *__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5240 PyObject *__pyx_r = 0;
5241 __Pyx_RefNannyDeclarations
5242 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
5243 __pyx_r = __pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5246 __Pyx_RefNannyFinishContext();
5250 static PyObject *__pyx_pf_15superluWrappers_12SparseFactor_4__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5251 PyObject *__pyx_r = NULL;
5252 __Pyx_RefNannyDeclarations
5253 PyObject *__pyx_t_1 = NULL;
5254 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
5261 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5262 __Pyx_GOTREF(__pyx_t_1);
5263 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5264 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5265 __PYX_ERR(1, 4, __pyx_L1_error)
5276 __Pyx_XDECREF(__pyx_t_1);
5277 __Pyx_AddTraceback(
"superluWrappers.SparseFactor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5279 __Pyx_XGIVEREF(__pyx_r);
5280 __Pyx_RefNannyFinishContext();
5293 static PyObject *__pyx_pw_15superluWrappers_1sparseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5294 static char __pyx_doc_15superluWrappers_sparseFactorPrepare[] =
" Python wrapper for superlu Sparse Factor Prepare function.\n\n Arguments\n ---------\n sparse_matrix : superluWrappers.SparseMatrix\n sparseFactor: superluWrappers.SparseFactor\n\n ";
5295 static PyMethodDef __pyx_mdef_15superluWrappers_1sparseFactorPrepare = {
"sparseFactorPrepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_1sparseFactorPrepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_sparseFactorPrepare};
5296 static PyObject *__pyx_pw_15superluWrappers_1sparseFactorPrepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5297 PyObject *__pyx_v_sparse_matrix = 0;
5298 PyObject *__pyx_v_sparseFactor = 0;
5299 PyObject *__pyx_r = 0;
5300 __Pyx_RefNannyDeclarations
5301 __Pyx_RefNannySetupContext(
"sparseFactorPrepare (wrapper)", 0);
5303 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sparse_matrix,&__pyx_n_s_sparseFactor,0};
5304 PyObject* values[2] = {0,0};
5305 if (unlikely(__pyx_kwds)) {
5307 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5309 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5311 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5314 default:
goto __pyx_L5_argtuple_error;
5316 kw_args = PyDict_Size(__pyx_kwds);
5319 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparse_matrix)) != 0)) kw_args--;
5320 else goto __pyx_L5_argtuple_error;
5323 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparseFactor)) != 0)) kw_args--;
5325 __Pyx_RaiseArgtupleInvalid(
"sparseFactorPrepare", 1, 2, 2, 1); __PYX_ERR(0, 219, __pyx_L3_error)
5328 if (unlikely(kw_args > 0)) {
5329 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"sparseFactorPrepare") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
5331 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5332 goto __pyx_L5_argtuple_error;
5334 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5335 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5337 __pyx_v_sparse_matrix = values[0];
5338 __pyx_v_sparseFactor = values[1];
5340 goto __pyx_L4_argument_unpacking_done;
5341 __pyx_L5_argtuple_error:;
5342 __Pyx_RaiseArgtupleInvalid(
"sparseFactorPrepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
5344 __Pyx_AddTraceback(
"superluWrappers.sparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5345 __Pyx_RefNannyFinishContext();
5347 __pyx_L4_argument_unpacking_done:;
5348 __pyx_r = __pyx_pf_15superluWrappers_sparseFactorPrepare(__pyx_self, __pyx_v_sparse_matrix, __pyx_v_sparseFactor);
5351 __Pyx_RefNannyFinishContext();
5355 static PyObject *__pyx_pf_15superluWrappers_sparseFactorPrepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparse_matrix, PyObject *__pyx_v_sparseFactor) {
5356 PyObject *__pyx_r = NULL;
5357 __Pyx_RefNannyDeclarations
5358 PyObject *__pyx_t_1 = NULL;
5359 __Pyx_RefNannySetupContext(
"sparseFactorPrepare", 0);
5368 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sparse_matrix, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
5369 __Pyx_GOTREF(__pyx_t_1);
5370 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 229, __pyx_L1_error)
5379 if (!(likely(((__pyx_v_sparseFactor) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sparseFactor, __pyx_ptype_15superluWrappers_SparseFactor))))) __PYX_ERR(0, 230, __pyx_L1_error)
5388 __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(((
struct __pyx_obj_15superluWrappers_cSparseMatrix *)__pyx_t_1), ((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_sparseFactor));
5389 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5400 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5403 __Pyx_XDECREF(__pyx_t_1);
5404 __Pyx_AddTraceback(
"superluWrappers.sparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5407 __Pyx_XGIVEREF(__pyx_r);
5408 __Pyx_RefNannyFinishContext();
5420 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorPrepare(
struct __pyx_obj_15superluWrappers_cSparseMatrix *__pyx_v_sm,
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_sparseFactor) {
5421 int __pyx_v_permc_spec;
5424 int __pyx_v_panel_size;
5428 PyObject *__pyx_v_i = NULL;
5429 __Pyx_RefNannyDeclarations
5430 __pyx_t_5numpy_int32_t __pyx_t_1;
5433 PyObject *__pyx_t_4 = NULL;
5434 PyObject *__pyx_t_5 = NULL;
5435 Py_ssize_t __pyx_t_6;
5436 PyObject *(*__pyx_t_7)(PyObject *);
5437 Py_ssize_t __pyx_t_8;
5438 Py_ssize_t __pyx_t_9;
5439 __Pyx_RefNannySetupContext(
"superluWrappersSparseFactorPrepare", 0);
5448 __pyx_v_permc_spec = 3;
5466 __pyx_v_panel_size = 10;
5493 __pyx_v_work = NULL;
5502 __pyx_t_1 = __pyx_v_sm->A.nnz;
5503 __pyx_v_sparseFactor->storeA.nnz = __pyx_t_1;
5512 __pyx_v_sparseFactor->storeA.nzval = (&(__pyx_v_sm->A.nzval[0]));
5521 __pyx_v_sparseFactor->storeA.colptr = (&(__pyx_v_sm->A.rowptr[0]));
5530 __pyx_v_sparseFactor->storeA.rowind = (&(__pyx_v_sm->A.colind[0]));
5539 __pyx_t_2 = ((__pyx_v_sparseFactor->use_same_perm_c == 0) != 0);
5549 get_perm_c(__pyx_v_permc_spec, (&__pyx_v_sparseFactor->A), __pyx_v_sparseFactor->perm_c);
5558 __pyx_v_sparseFactor->use_same_perm_c = 1;
5576 __pyx_t_2 = ((__pyx_v_sparseFactor->use_same_sparsity == 0) != 0);
5586 __pyx_t_2 = ((__pyx_v_sparseFactor->AC.Store != NULL) != 0);
5596 Destroy_CompCol_Permuted((&__pyx_v_sparseFactor->AC));
5605 Destroy_SuperNode_Matrix((&__pyx_v_sparseFactor->L));
5614 Destroy_CompCol_Matrix((&__pyx_v_sparseFactor->U));
5632 sp_preorder((&__pyx_v_sparseFactor->options), (&__pyx_v_sparseFactor->A), __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->etree, (&__pyx_v_sparseFactor->AC));
5641 __pyx_v_sparseFactor->use_same_sparsity = 1;
5661 __pyx_v_sparseFactor->options.Fact = SamePattern_SameRowPerm;
5670 __pyx_t_3 = __pyx_v_sparseFactor->A.ncol;
5671 __pyx_v_n = __pyx_t_3;
5680 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5681 __Pyx_GOTREF(__pyx_t_4);
5682 __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5683 __Pyx_GOTREF(__pyx_t_5);
5684 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5685 if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
5686 __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
5689 __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5690 __Pyx_GOTREF(__pyx_t_4);
5691 __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 268, __pyx_L1_error)
5693 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5695 if (likely(!__pyx_t_7)) {
5696 if (likely(PyList_CheckExact(__pyx_t_4))) {
5697 if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4))
break;
5698 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 5699 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
if (unlikely(0 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
5701 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5702 __Pyx_GOTREF(__pyx_t_5);
5705 if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
5706 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 5707 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
if (unlikely(0 < 0)) __PYX_ERR(0, 268, __pyx_L1_error)
5709 __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 268, __pyx_L1_error)
5710 __Pyx_GOTREF(__pyx_t_5);
5714 __pyx_t_5 = __pyx_t_7(__pyx_t_4);
5715 if (unlikely(!__pyx_t_5)) {
5716 PyObject* exc_type = PyErr_Occurred();
5718 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5719 else __PYX_ERR(0, 268, __pyx_L1_error)
5723 __Pyx_GOTREF(__pyx_t_5);
5725 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
5735 __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5736 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5737 (((
struct __pyx_t_15superluWrappers__NCPformat *)__pyx_v_sparseFactor->AC.Store)->colbeg[(__pyx_v_sparseFactor->perm_c[__pyx_t_9])]) = (((
struct __pyx_t_15superluWrappers__NCformat *)__pyx_v_sparseFactor->A.Store)->colptr[__pyx_t_8]);
5746 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 270, __pyx_L1_error)
5747 __Pyx_GOTREF(__pyx_t_5);
5748 __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
5749 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5750 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
5751 (((
struct __pyx_t_15superluWrappers__NCPformat *)__pyx_v_sparseFactor->AC.Store)->colend[(__pyx_v_sparseFactor->perm_c[__pyx_t_9])]) = (((
struct __pyx_t_15superluWrappers__NCformat *)__pyx_v_sparseFactor->A.Store)->colptr[__pyx_t_8]);
5761 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5772 dgstrf((&__pyx_v_sparseFactor->options), (&__pyx_v_sparseFactor->AC), __pyx_v_relax, __pyx_v_panel_size, __pyx_v_sparseFactor->etree, __pyx_v_work, __pyx_v_lwork, __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->perm_r, (&__pyx_v_sparseFactor->L), (&__pyx_v_sparseFactor->U), (&__pyx_v_sparseFactor->Glu), (&__pyx_v_sparseFactor->stat), (&__pyx_v_info));
5785 __Pyx_XDECREF(__pyx_t_4);
5786 __Pyx_XDECREF(__pyx_t_5);
5787 __Pyx_WriteUnraisable(
"superluWrappers.superluWrappersSparseFactorPrepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5789 __Pyx_XDECREF(__pyx_v_i);
5790 __Pyx_RefNannyFinishContext();
5802 static PyObject *__pyx_pw_15superluWrappers_3sparseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5803 static char __pyx_doc_15superluWrappers_2sparseFactorSolve[] =
" Sparse factor solve wrappers\n\n Arguments\n ---------\n sparseFactor : superluWrappers.SparseFactor\n x (input / output) : np.array\n x serves as the right hand side and then becomes the solution\n ";
5804 static PyMethodDef __pyx_mdef_15superluWrappers_3sparseFactorSolve = {
"sparseFactorSolve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15superluWrappers_3sparseFactorSolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_15superluWrappers_2sparseFactorSolve};
5805 static PyObject *__pyx_pw_15superluWrappers_3sparseFactorSolve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5806 PyObject *__pyx_v_sparseFactor = 0;
5807 PyObject *__pyx_v_x = 0;
5808 PyObject *__pyx_r = 0;
5809 __Pyx_RefNannyDeclarations
5810 __Pyx_RefNannySetupContext(
"sparseFactorSolve (wrapper)", 0);
5812 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sparseFactor,&__pyx_n_s_x,0};
5813 PyObject* values[2] = {0,0};
5814 if (unlikely(__pyx_kwds)) {
5816 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5818 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5820 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5823 default:
goto __pyx_L5_argtuple_error;
5825 kw_args = PyDict_Size(__pyx_kwds);
5828 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sparseFactor)) != 0)) kw_args--;
5829 else goto __pyx_L5_argtuple_error;
5832 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5834 __Pyx_RaiseArgtupleInvalid(
"sparseFactorSolve", 1, 2, 2, 1); __PYX_ERR(0, 286, __pyx_L3_error)
5837 if (unlikely(kw_args > 0)) {
5838 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"sparseFactorSolve") < 0)) __PYX_ERR(0, 286, __pyx_L3_error)
5840 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5841 goto __pyx_L5_argtuple_error;
5843 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5844 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5846 __pyx_v_sparseFactor = values[0];
5847 __pyx_v_x = values[1];
5849 goto __pyx_L4_argument_unpacking_done;
5850 __pyx_L5_argtuple_error:;
5851 __Pyx_RaiseArgtupleInvalid(
"sparseFactorSolve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
5853 __Pyx_AddTraceback(
"superluWrappers.sparseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5854 __Pyx_RefNannyFinishContext();
5856 __pyx_L4_argument_unpacking_done:;
5857 __pyx_r = __pyx_pf_15superluWrappers_2sparseFactorSolve(__pyx_self, __pyx_v_sparseFactor, __pyx_v_x);
5860 __Pyx_RefNannyFinishContext();
5864 static PyObject *__pyx_pf_15superluWrappers_2sparseFactorSolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sparseFactor, PyObject *__pyx_v_x) {
5865 PyObject *__pyx_r = NULL;
5866 __Pyx_RefNannyDeclarations
5867 __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
5868 __Pyx_RefNannySetupContext(
"sparseFactorSolve", 0);
5877 if (!(likely(((__pyx_v_sparseFactor) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_sparseFactor, __pyx_ptype_15superluWrappers_SparseFactor))))) __PYX_ERR(0, 296, __pyx_L1_error)
5886 __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_x, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 297, __pyx_L1_error)
5895 __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(((
struct __pyx_obj_15superluWrappers_SparseFactor *)__pyx_v_sparseFactor), __pyx_t_1);
5896 __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5897 __pyx_t_1.memview = NULL;
5898 __pyx_t_1.data = NULL;
5909 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5912 __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5913 __Pyx_AddTraceback(
"superluWrappers.sparseFactorSolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5916 __Pyx_XGIVEREF(__pyx_r);
5917 __Pyx_RefNannyFinishContext();
5929 static void __pyx_f_15superluWrappers_superluWrappersSparseFactorSolve(
struct __pyx_obj_15superluWrappers_SparseFactor *__pyx_v_sparseFactor, __Pyx_memviewslice __pyx_v_x) {
5930 trans_t __pyx_v_trans;
5932 __Pyx_RefNannyDeclarations
5933 Py_ssize_t __pyx_t_1;
5934 __Pyx_RefNannySetupContext(
"superluWrappersSparseFactorSolve", 0);
5943 __pyx_v_trans = TRANS;
5962 __pyx_v_sparseFactor->storeX.nzval = (&(*((__pyx_t_5numpy_float64_t *) ( (__pyx_v_x.data + __pyx_t_1 * __pyx_v_x.strides[0]) ))));
5971 dgstrs(__pyx_v_trans, (&__pyx_v_sparseFactor->L), (&__pyx_v_sparseFactor->U), __pyx_v_sparseFactor->perm_c, __pyx_v_sparseFactor->perm_r, (&__pyx_v_sparseFactor->X), (&__pyx_v_sparseFactor->stat), (&__pyx_v_info));
5982 __Pyx_RefNannyFinishContext();
5994 static CYTHON_UNUSED
int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
5995 static CYTHON_UNUSED
int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
5997 __Pyx_RefNannyDeclarations
5998 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
5999 __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
6002 __Pyx_RefNannyFinishContext();
6006 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6009 int __pyx_v_endian_detector;
6010 int __pyx_v_little_endian;
6013 PyArray_Descr *__pyx_v_descr = 0;
6016 __Pyx_RefNannyDeclarations
6019 PyObject *__pyx_t_3 = NULL;
6023 PyArray_Descr *__pyx_t_7;
6024 PyObject *__pyx_t_8 = NULL;
6026 if (__pyx_v_info == NULL) {
6027 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
6030 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
6031 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6032 __Pyx_GIVEREF(__pyx_v_info->obj);
6041 __pyx_v_endian_detector = 1;
6050 __pyx_v_little_endian = ((((
char *)(&__pyx_v_endian_detector))[0]) != 0);
6059 __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
6068 __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
6071 __pyx_t_1 = __pyx_t_2;
6072 goto __pyx_L4_bool_binop_done;
6082 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
6083 __pyx_t_1 = __pyx_t_2;
6084 __pyx_L4_bool_binop_done:;
6093 if (unlikely(__pyx_t_1)) {
6102 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
6103 __Pyx_GOTREF(__pyx_t_3);
6104 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6105 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6106 __PYX_ERR(2, 272, __pyx_L1_error)
6124 __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
6127 __pyx_t_1 = __pyx_t_2;
6128 goto __pyx_L7_bool_binop_done;
6138 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
6139 __pyx_t_1 = __pyx_t_2;
6140 __pyx_L7_bool_binop_done:;
6149 if (unlikely(__pyx_t_1)) {
6158 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
6159 __Pyx_GOTREF(__pyx_t_3);
6160 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6161 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6162 __PYX_ERR(2, 276, __pyx_L1_error)
6180 __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
6189 __pyx_v_info->ndim = __pyx_v_ndim;
6198 __pyx_t_1 = (((
sizeof(npy_intp)) != (
sizeof(Py_ssize_t))) != 0);
6208 __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
6217 __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
6226 __pyx_t_4 = __pyx_v_ndim;
6227 __pyx_t_5 = __pyx_t_4;
6228 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6229 __pyx_v_i = __pyx_t_6;
6238 (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
6247 (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
6268 __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
6277 __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
6288 __pyx_v_info->suboffsets = NULL;
6297 __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
6306 __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
6324 __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
6325 __pyx_t_3 = ((PyObject *)__pyx_t_7);
6326 __Pyx_INCREF(__pyx_t_3);
6327 __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
6337 __Pyx_INCREF(((PyObject *)__pyx_v_self));
6338 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
6339 __Pyx_GOTREF(__pyx_v_info->obj);
6340 __Pyx_DECREF(__pyx_v_info->obj);
6341 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
6350 __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
6360 __pyx_t_4 = __pyx_v_descr->type_num;
6361 __pyx_v_t = __pyx_t_4;
6370 __pyx_t_2 = ((__pyx_v_descr->byteorder ==
'>') != 0);
6372 goto __pyx_L15_next_or;
6375 __pyx_t_2 = (__pyx_v_little_endian != 0);
6378 __pyx_t_1 = __pyx_t_2;
6379 goto __pyx_L14_bool_binop_done;
6390 __pyx_t_2 = ((__pyx_v_descr->byteorder ==
'<') != 0);
6393 __pyx_t_1 = __pyx_t_2;
6394 goto __pyx_L14_bool_binop_done;
6396 __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
6397 __pyx_t_1 = __pyx_t_2;
6398 __pyx_L14_bool_binop_done:;
6407 if (unlikely(__pyx_t_1)) {
6416 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
6417 __Pyx_GOTREF(__pyx_t_3);
6418 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6419 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6420 __PYX_ERR(2, 306, __pyx_L1_error)
6438 switch (__pyx_v_t) {
6440 __pyx_v_f = ((
char *)
"b");
6451 __pyx_v_f = ((
char *)
"B");
6462 __pyx_v_f = ((
char *)
"h");
6473 __pyx_v_f = ((
char *)
"H");
6484 __pyx_v_f = ((
char *)
"i");
6495 __pyx_v_f = ((
char *)
"I");
6506 __pyx_v_f = ((
char *)
"l");
6517 __pyx_v_f = ((
char *)
"L");
6528 __pyx_v_f = ((
char *)
"q");
6539 __pyx_v_f = ((
char *)
"Q");
6550 __pyx_v_f = ((
char *)
"f");
6561 __pyx_v_f = ((
char *)
"d");
6563 case NPY_LONGDOUBLE:
6572 __pyx_v_f = ((
char *)
"g");
6583 __pyx_v_f = ((
char *)
"Zf");
6594 __pyx_v_f = ((
char *)
"Zd");
6596 case NPY_CLONGDOUBLE:
6605 __pyx_v_f = ((
char *)
"Zg");
6616 __pyx_v_f = ((
char *)
"O");
6627 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
6628 __Pyx_GOTREF(__pyx_t_3);
6629 __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
6630 __Pyx_GOTREF(__pyx_t_8);
6631 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6632 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
6633 __Pyx_GOTREF(__pyx_t_3);
6634 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6635 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6636 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6637 __PYX_ERR(2, 325, __pyx_L1_error)
6648 __pyx_v_info->format = __pyx_v_f;
6677 __pyx_v_info->format = ((
char *)PyObject_Malloc(0xFF));
6686 (__pyx_v_info->format[0]) =
'^';
6704 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset));
if (unlikely(__pyx_t_9 == ((
char *)NULL))) __PYX_ERR(2, 332, __pyx_L1_error)
6705 __pyx_v_f = __pyx_t_9;
6714 (__pyx_v_f[0]) =
'\x00';
6729 __Pyx_XDECREF(__pyx_t_3);
6730 __Pyx_XDECREF(__pyx_t_8);
6731 __Pyx_AddTraceback(
"numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6733 if (__pyx_v_info->obj != NULL) {
6734 __Pyx_GOTREF(__pyx_v_info->obj);
6735 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6739 if (__pyx_v_info->obj == Py_None) {
6740 __Pyx_GOTREF(__pyx_v_info->obj);
6741 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6744 __Pyx_XDECREF((PyObject *)__pyx_v_descr);
6745 __Pyx_RefNannyFinishContext();
6758 static CYTHON_UNUSED
void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info);
6759 static CYTHON_UNUSED
void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6760 __Pyx_RefNannyDeclarations
6761 __Pyx_RefNannySetupContext(
"__releasebuffer__ (wrapper)", 0);
6762 __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
6765 __Pyx_RefNannyFinishContext();
6768 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6769 __Pyx_RefNannyDeclarations
6771 __Pyx_RefNannySetupContext(
"__releasebuffer__", 0);
6780 __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
6790 PyObject_Free(__pyx_v_info->format);
6808 __pyx_t_1 = (((
sizeof(npy_intp)) != (
sizeof(Py_ssize_t))) != 0);
6818 PyObject_Free(__pyx_v_info->strides);
6838 __Pyx_RefNannyFinishContext();
6849 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6850 PyObject *__pyx_r = NULL;
6851 __Pyx_RefNannyDeclarations
6852 PyObject *__pyx_t_1 = NULL;
6853 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
6862 __Pyx_XDECREF(__pyx_r);
6863 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
6864 __Pyx_GOTREF(__pyx_t_1);
6865 __pyx_r = __pyx_t_1;
6879 __Pyx_XDECREF(__pyx_t_1);
6880 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6883 __Pyx_XGIVEREF(__pyx_r);
6884 __Pyx_RefNannyFinishContext();
6896 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6897 PyObject *__pyx_r = NULL;
6898 __Pyx_RefNannyDeclarations
6899 PyObject *__pyx_t_1 = NULL;
6900 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
6909 __Pyx_XDECREF(__pyx_r);
6910 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 825, __pyx_L1_error)
6911 __Pyx_GOTREF(__pyx_t_1);
6912 __pyx_r = __pyx_t_1;
6926 __Pyx_XDECREF(__pyx_t_1);
6927 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6930 __Pyx_XGIVEREF(__pyx_r);
6931 __Pyx_RefNannyFinishContext();
6943 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6944 PyObject *__pyx_r = NULL;
6945 __Pyx_RefNannyDeclarations
6946 PyObject *__pyx_t_1 = NULL;
6947 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
6956 __Pyx_XDECREF(__pyx_r);
6957 __pyx_t_1 = PyArray_MultiIterNew(3, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 828, __pyx_L1_error)
6958 __Pyx_GOTREF(__pyx_t_1);
6959 __pyx_r = __pyx_t_1;
6973 __Pyx_XDECREF(__pyx_t_1);
6974 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6977 __Pyx_XGIVEREF(__pyx_r);
6978 __Pyx_RefNannyFinishContext();
6990 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
6991 PyObject *__pyx_r = NULL;
6992 __Pyx_RefNannyDeclarations
6993 PyObject *__pyx_t_1 = NULL;
6994 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
7003 __Pyx_XDECREF(__pyx_r);
7004 __pyx_t_1 = PyArray_MultiIterNew(4, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 831, __pyx_L1_error)
7005 __Pyx_GOTREF(__pyx_t_1);
7006 __pyx_r = __pyx_t_1;
7020 __Pyx_XDECREF(__pyx_t_1);
7021 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
7024 __Pyx_XGIVEREF(__pyx_r);
7025 __Pyx_RefNannyFinishContext();
7037 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
7038 PyObject *__pyx_r = NULL;
7039 __Pyx_RefNannyDeclarations
7040 PyObject *__pyx_t_1 = NULL;
7041 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
7050 __Pyx_XDECREF(__pyx_r);
7051 __pyx_t_1 = PyArray_MultiIterNew(5, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d), ((
void *)__pyx_v_e));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 834, __pyx_L1_error)
7052 __Pyx_GOTREF(__pyx_t_1);
7053 __pyx_r = __pyx_t_1;
7067 __Pyx_XDECREF(__pyx_t_1);
7068 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
7071 __Pyx_XGIVEREF(__pyx_r);
7072 __Pyx_RefNannyFinishContext();
7084 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
7085 PyObject *__pyx_r = NULL;
7086 __Pyx_RefNannyDeclarations
7088 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
7097 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
7107 __Pyx_XDECREF(__pyx_r);
7108 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
7109 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
7129 __Pyx_XDECREF(__pyx_r);
7130 __Pyx_INCREF(__pyx_empty_tuple);
7131 __pyx_r = __pyx_empty_tuple;
7145 __Pyx_XGIVEREF(__pyx_r);
7146 __Pyx_RefNannyFinishContext();
7158 static CYTHON_INLINE
char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr,
char *__pyx_v_f,
char *__pyx_v_end,
int *__pyx_v_offset) {
7159 PyArray_Descr *__pyx_v_child = 0;
7160 int __pyx_v_endian_detector;
7161 int __pyx_v_little_endian;
7162 PyObject *__pyx_v_fields = 0;
7163 PyObject *__pyx_v_childname = NULL;
7164 PyObject *__pyx_v_new_offset = NULL;
7165 PyObject *__pyx_v_t = NULL;
7167 __Pyx_RefNannyDeclarations
7168 PyObject *__pyx_t_1 = NULL;
7169 Py_ssize_t __pyx_t_2;
7170 PyObject *__pyx_t_3 = NULL;
7171 PyObject *__pyx_t_4 = NULL;
7177 __Pyx_RefNannySetupContext(
"_util_dtypestring", 0);
7186 __pyx_v_endian_detector = 1;
7195 __pyx_v_little_endian = ((((
char *)(&__pyx_v_endian_detector))[0]) != 0);
7204 if (unlikely(__pyx_v_descr->names == Py_None)) {
7205 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
7206 __PYX_ERR(2, 851, __pyx_L1_error)
7208 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
7210 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1))
break;
7211 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 7212 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
if (unlikely(0 < 0)) __PYX_ERR(2, 851, __pyx_L1_error)
7214 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 851, __pyx_L1_error)
7215 __Pyx_GOTREF(__pyx_t_3);
7217 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
7227 if (unlikely(__pyx_v_descr->fields == Py_None)) {
7228 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
7229 __PYX_ERR(2, 852, __pyx_L1_error)
7231 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __pyx_L1_error)
7232 __Pyx_GOTREF(__pyx_t_3);
7233 if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 852, __pyx_L1_error)
7234 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
7244 if (likely(__pyx_v_fields != Py_None)) {
7245 PyObject* sequence = __pyx_v_fields;
7246 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7247 if (unlikely(size != 2)) {
7248 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7249 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7250 __PYX_ERR(2, 853, __pyx_L1_error)
7252 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 7253 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
7254 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
7255 __Pyx_INCREF(__pyx_t_3);
7256 __Pyx_INCREF(__pyx_t_4);
7258 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
7259 __Pyx_GOTREF(__pyx_t_3);
7260 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
7261 __Pyx_GOTREF(__pyx_t_4);
7264 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
7266 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
7267 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
7269 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
7279 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0]));
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
7280 __Pyx_GOTREF(__pyx_t_4);
7281 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
7282 __Pyx_GOTREF(__pyx_t_3);
7283 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7284 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 855, __pyx_L1_error)
7285 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7286 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((
int)__pyx_t_5)) < 15) != 0);
7287 if (unlikely(__pyx_t_6)) {
7296 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
7297 __Pyx_GOTREF(__pyx_t_3);
7298 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7299 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7300 __PYX_ERR(2, 856, __pyx_L1_error)
7318 __pyx_t_7 = ((__pyx_v_child->byteorder ==
'>') != 0);
7320 goto __pyx_L8_next_or;
7323 __pyx_t_7 = (__pyx_v_little_endian != 0);
7326 __pyx_t_6 = __pyx_t_7;
7327 goto __pyx_L7_bool_binop_done;
7338 __pyx_t_7 = ((__pyx_v_child->byteorder ==
'<') != 0);
7341 __pyx_t_6 = __pyx_t_7;
7342 goto __pyx_L7_bool_binop_done;
7344 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
7345 __pyx_t_6 = __pyx_t_7;
7346 __pyx_L7_bool_binop_done:;
7355 if (unlikely(__pyx_t_6)) {
7364 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
7365 __Pyx_GOTREF(__pyx_t_3);
7366 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7367 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7368 __PYX_ERR(2, 860, __pyx_L1_error)
7387 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0]));
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
7388 __Pyx_GOTREF(__pyx_t_3);
7389 __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 870, __pyx_L1_error)
7390 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7391 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
7392 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7393 if (!__pyx_t_6)
break;
7402 (__pyx_v_f[0]) = 0x78;
7411 __pyx_v_f = (__pyx_v_f + 1);
7421 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
7432 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
7441 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
7451 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
7452 __Pyx_GOTREF(__pyx_t_4);
7453 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
7463 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
7464 if (unlikely(__pyx_t_6)) {
7473 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
7474 __Pyx_GOTREF(__pyx_t_4);
7475 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7476 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7477 __PYX_ERR(2, 880, __pyx_L1_error)
7495 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
7496 __Pyx_GOTREF(__pyx_t_4);
7497 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 883, __pyx_L1_error)
7498 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7499 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
7500 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7502 (__pyx_v_f[0]) = 98;
7513 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
7514 __Pyx_GOTREF(__pyx_t_3);
7515 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 884, __pyx_L1_error)
7516 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7517 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
7518 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7520 (__pyx_v_f[0]) = 66;
7531 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
7532 __Pyx_GOTREF(__pyx_t_4);
7533 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 885, __pyx_L1_error)
7534 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7535 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
7536 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7538 (__pyx_v_f[0]) = 0x68;
7549 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
7550 __Pyx_GOTREF(__pyx_t_3);
7551 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 886, __pyx_L1_error)
7552 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7553 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
7554 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7556 (__pyx_v_f[0]) = 72;
7567 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
7568 __Pyx_GOTREF(__pyx_t_4);
7569 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 887, __pyx_L1_error)
7570 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7571 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
7572 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7574 (__pyx_v_f[0]) = 0x69;
7585 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
7586 __Pyx_GOTREF(__pyx_t_3);
7587 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 888, __pyx_L1_error)
7588 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7589 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
7590 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7592 (__pyx_v_f[0]) = 73;
7603 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
7604 __Pyx_GOTREF(__pyx_t_4);
7605 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 889, __pyx_L1_error)
7606 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7607 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
7608 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7610 (__pyx_v_f[0]) = 0x6C;
7621 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
7622 __Pyx_GOTREF(__pyx_t_3);
7623 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 890, __pyx_L1_error)
7624 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7625 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
7626 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7628 (__pyx_v_f[0]) = 76;
7639 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
7640 __Pyx_GOTREF(__pyx_t_4);
7641 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 891, __pyx_L1_error)
7642 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7643 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
7644 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7646 (__pyx_v_f[0]) = 0x71;
7657 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
7658 __Pyx_GOTREF(__pyx_t_3);
7659 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 892, __pyx_L1_error)
7660 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7661 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
7662 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7664 (__pyx_v_f[0]) = 81;
7675 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
7676 __Pyx_GOTREF(__pyx_t_4);
7677 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 893, __pyx_L1_error)
7678 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7679 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
7680 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7682 (__pyx_v_f[0]) = 0x66;
7693 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
7694 __Pyx_GOTREF(__pyx_t_3);
7695 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 894, __pyx_L1_error)
7696 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7697 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
7698 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7700 (__pyx_v_f[0]) = 0x64;
7711 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
7712 __Pyx_GOTREF(__pyx_t_4);
7713 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 895, __pyx_L1_error)
7714 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7715 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
7716 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7718 (__pyx_v_f[0]) = 0x67;
7729 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
7730 __Pyx_GOTREF(__pyx_t_3);
7731 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 896, __pyx_L1_error)
7732 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7733 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
7734 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7736 (__pyx_v_f[0]) = 90;
7737 (__pyx_v_f[1]) = 0x66;
7738 __pyx_v_f = (__pyx_v_f + 1);
7749 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
7750 __Pyx_GOTREF(__pyx_t_4);
7751 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 897, __pyx_L1_error)
7752 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7753 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
7754 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7756 (__pyx_v_f[0]) = 90;
7757 (__pyx_v_f[1]) = 0x64;
7758 __pyx_v_f = (__pyx_v_f + 1);
7769 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
7770 __Pyx_GOTREF(__pyx_t_3);
7771 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 898, __pyx_L1_error)
7772 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7773 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
7774 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7776 (__pyx_v_f[0]) = 90;
7777 (__pyx_v_f[1]) = 0x67;
7778 __pyx_v_f = (__pyx_v_f + 1);
7789 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
7790 __Pyx_GOTREF(__pyx_t_4);
7791 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 899, __pyx_L1_error)
7792 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7793 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
7794 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7795 if (likely(__pyx_t_6)) {
7796 (__pyx_v_f[0]) = 79;
7808 __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
7809 __Pyx_GOTREF(__pyx_t_3);
7810 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
7811 __Pyx_GOTREF(__pyx_t_4);
7812 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7813 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7814 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7815 __PYX_ERR(2, 901, __pyx_L1_error)
7826 __pyx_v_f = (__pyx_v_f + 1);
7846 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset);
if (unlikely(__pyx_t_9 == ((
char *)NULL))) __PYX_ERR(2, 906, __pyx_L1_error)
7847 __pyx_v_f = __pyx_t_9;
7859 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7868 __pyx_r = __pyx_v_f;
7881 __Pyx_XDECREF(__pyx_t_1);
7882 __Pyx_XDECREF(__pyx_t_3);
7883 __Pyx_XDECREF(__pyx_t_4);
7884 __Pyx_AddTraceback(
"numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
7887 __Pyx_XDECREF((PyObject *)__pyx_v_child);
7888 __Pyx_XDECREF(__pyx_v_fields);
7889 __Pyx_XDECREF(__pyx_v_childname);
7890 __Pyx_XDECREF(__pyx_v_new_offset);
7891 __Pyx_XDECREF(__pyx_v_t);
7892 __Pyx_RefNannyFinishContext();
7904 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7905 __Pyx_RefNannyDeclarations
7906 __Pyx_RefNannySetupContext(
"set_array_base", 0);
7915 Py_INCREF(__pyx_v_base);
7924 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
7935 __Pyx_RefNannyFinishContext();
7946 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7947 PyObject *__pyx_v_base;
7948 PyObject *__pyx_r = NULL;
7949 __Pyx_RefNannyDeclarations
7951 __Pyx_RefNannySetupContext(
"get_array_base", 0);
7960 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
7969 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
7979 __Pyx_XDECREF(__pyx_r);
7980 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7999 __Pyx_XDECREF(__pyx_r);
8000 __Pyx_INCREF(((PyObject *)__pyx_v_base));
8001 __pyx_r = ((PyObject *)__pyx_v_base);
8014 __Pyx_XGIVEREF(__pyx_r);
8015 __Pyx_RefNannyFinishContext();
8027 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
8029 __Pyx_RefNannyDeclarations
8030 PyObject *__pyx_t_1 = NULL;
8031 PyObject *__pyx_t_2 = NULL;
8032 PyObject *__pyx_t_3 = NULL;
8034 PyObject *__pyx_t_5 = NULL;
8035 PyObject *__pyx_t_6 = NULL;
8036 PyObject *__pyx_t_7 = NULL;
8037 PyObject *__pyx_t_8 = NULL;
8038 __Pyx_RefNannySetupContext(
"import_array", 0);
8048 __Pyx_PyThreadState_declare
8049 __Pyx_PyThreadState_assign
8050 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
8051 __Pyx_XGOTREF(__pyx_t_1);
8052 __Pyx_XGOTREF(__pyx_t_2);
8053 __Pyx_XGOTREF(__pyx_t_3);
8063 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)
8073 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8074 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8075 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8076 goto __pyx_L8_try_end;
8086 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
8088 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
8089 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
8090 __Pyx_GOTREF(__pyx_t_5);
8091 __Pyx_GOTREF(__pyx_t_6);
8092 __Pyx_GOTREF(__pyx_t_7);
8101 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
8102 __Pyx_GOTREF(__pyx_t_8);
8103 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8104 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8105 __PYX_ERR(2, 1038, __pyx_L5_except_error)
8107 goto __pyx_L5_except_error;
8108 __pyx_L5_except_error:;
8117 __Pyx_XGIVEREF(__pyx_t_1);
8118 __Pyx_XGIVEREF(__pyx_t_2);
8119 __Pyx_XGIVEREF(__pyx_t_3);
8120 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
8121 goto __pyx_L1_error;
8137 __Pyx_XDECREF(__pyx_t_5);
8138 __Pyx_XDECREF(__pyx_t_6);
8139 __Pyx_XDECREF(__pyx_t_7);
8140 __Pyx_XDECREF(__pyx_t_8);
8141 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
8144 __Pyx_RefNannyFinishContext();
8156 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
8158 __Pyx_RefNannyDeclarations
8159 PyObject *__pyx_t_1 = NULL;
8160 PyObject *__pyx_t_2 = NULL;
8161 PyObject *__pyx_t_3 = NULL;
8163 PyObject *__pyx_t_5 = NULL;
8164 PyObject *__pyx_t_6 = NULL;
8165 PyObject *__pyx_t_7 = NULL;
8166 PyObject *__pyx_t_8 = NULL;
8167 __Pyx_RefNannySetupContext(
"import_umath", 0);
8177 __Pyx_PyThreadState_declare
8178 __Pyx_PyThreadState_assign
8179 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
8180 __Pyx_XGOTREF(__pyx_t_1);
8181 __Pyx_XGOTREF(__pyx_t_2);
8182 __Pyx_XGOTREF(__pyx_t_3);
8192 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)
8202 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8203 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8204 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8205 goto __pyx_L8_try_end;
8215 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
8217 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
8218 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
8219 __Pyx_GOTREF(__pyx_t_5);
8220 __Pyx_GOTREF(__pyx_t_6);
8221 __Pyx_GOTREF(__pyx_t_7);
8230 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
8231 __Pyx_GOTREF(__pyx_t_8);
8232 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8233 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8234 __PYX_ERR(2, 1044, __pyx_L5_except_error)
8236 goto __pyx_L5_except_error;
8237 __pyx_L5_except_error:;
8246 __Pyx_XGIVEREF(__pyx_t_1);
8247 __Pyx_XGIVEREF(__pyx_t_2);
8248 __Pyx_XGIVEREF(__pyx_t_3);
8249 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
8250 goto __pyx_L1_error;
8266 __Pyx_XDECREF(__pyx_t_5);
8267 __Pyx_XDECREF(__pyx_t_6);
8268 __Pyx_XDECREF(__pyx_t_7);
8269 __Pyx_XDECREF(__pyx_t_8);
8270 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
8273 __Pyx_RefNannyFinishContext();
8285 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
8287 __Pyx_RefNannyDeclarations
8288 PyObject *__pyx_t_1 = NULL;
8289 PyObject *__pyx_t_2 = NULL;
8290 PyObject *__pyx_t_3 = NULL;
8292 PyObject *__pyx_t_5 = NULL;
8293 PyObject *__pyx_t_6 = NULL;
8294 PyObject *__pyx_t_7 = NULL;
8295 PyObject *__pyx_t_8 = NULL;
8296 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
8306 __Pyx_PyThreadState_declare
8307 __Pyx_PyThreadState_assign
8308 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
8309 __Pyx_XGOTREF(__pyx_t_1);
8310 __Pyx_XGOTREF(__pyx_t_2);
8311 __Pyx_XGOTREF(__pyx_t_3);
8321 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)
8331 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8332 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8333 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8334 goto __pyx_L8_try_end;
8343 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
8345 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
8346 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
8347 __Pyx_GOTREF(__pyx_t_5);
8348 __Pyx_GOTREF(__pyx_t_6);
8349 __Pyx_GOTREF(__pyx_t_7);
8356 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
8357 __Pyx_GOTREF(__pyx_t_8);
8358 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8359 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8360 __PYX_ERR(2, 1050, __pyx_L5_except_error)
8362 goto __pyx_L5_except_error;
8363 __pyx_L5_except_error:;
8372 __Pyx_XGIVEREF(__pyx_t_1);
8373 __Pyx_XGIVEREF(__pyx_t_2);
8374 __Pyx_XGIVEREF(__pyx_t_3);
8375 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
8376 goto __pyx_L1_error;
8392 __Pyx_XDECREF(__pyx_t_5);
8393 __Pyx_XDECREF(__pyx_t_6);
8394 __Pyx_XDECREF(__pyx_t_7);
8395 __Pyx_XDECREF(__pyx_t_8);
8396 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
8399 __Pyx_RefNannyFinishContext();
8412 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8413 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8414 PyObject *__pyx_v_shape = 0;
8415 Py_ssize_t __pyx_v_itemsize;
8416 PyObject *__pyx_v_format = 0;
8417 PyObject *__pyx_v_mode = 0;
8418 int __pyx_v_allocate_buffer;
8420 __Pyx_RefNannyDeclarations
8421 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
8423 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
8424 PyObject* values[5] = {0,0,0,0,0};
8425 values[3] = ((PyObject *)__pyx_n_s_c);
8426 if (unlikely(__pyx_kwds)) {
8428 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8430 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8432 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8434 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8436 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8438 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8441 default:
goto __pyx_L5_argtuple_error;
8443 kw_args = PyDict_Size(__pyx_kwds);
8446 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
8447 else goto __pyx_L5_argtuple_error;
8450 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
8452 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
8456 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
8458 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
8463 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
8464 if (value) { values[3] = value; kw_args--; }
8469 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
8470 if (value) { values[4] = value; kw_args--; }
8473 if (unlikely(kw_args > 0)) {
8474 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
8477 switch (PyTuple_GET_SIZE(__pyx_args)) {
8478 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8480 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8482 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8483 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8484 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8486 default:
goto __pyx_L5_argtuple_error;
8489 __pyx_v_shape = ((PyObject*)values[0]);
8490 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
8491 __pyx_v_format = values[2];
8492 __pyx_v_mode = values[3];
8494 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
8504 __pyx_v_allocate_buffer = ((int)1);
8507 goto __pyx_L4_argument_unpacking_done;
8508 __pyx_L5_argtuple_error:;
8509 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
8511 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8512 __Pyx_RefNannyFinishContext();
8514 __pyx_L4_argument_unpacking_done:;
8515 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
8516 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
8517 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(1, 122, __pyx_L1_error)
8519 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
8534 __Pyx_RefNannyFinishContext();
8538 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
8540 Py_ssize_t __pyx_v_i;
8541 Py_ssize_t __pyx_v_dim;
8542 PyObject **__pyx_v_p;
8545 __Pyx_RefNannyDeclarations
8546 Py_ssize_t __pyx_t_1;
8548 PyObject *__pyx_t_3 = NULL;
8550 PyObject *__pyx_t_5 = NULL;
8551 PyObject *__pyx_t_6 = NULL;
8554 Py_ssize_t __pyx_t_9;
8555 PyObject *__pyx_t_10 = NULL;
8556 Py_ssize_t __pyx_t_11;
8557 __Pyx_RefNannySetupContext(
"__cinit__", 0);
8558 __Pyx_INCREF(__pyx_v_format);
8567 if (unlikely(__pyx_v_shape == Py_None)) {
8568 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
8569 __PYX_ERR(1, 129, __pyx_L1_error)
8571 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
8572 __pyx_v_self->ndim = ((int)__pyx_t_1);
8581 __pyx_v_self->itemsize = __pyx_v_itemsize;
8590 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
8591 if (unlikely(__pyx_t_2)) {
8600 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
8601 __Pyx_GOTREF(__pyx_t_3);
8602 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8603 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8604 __PYX_ERR(1, 133, __pyx_L1_error)
8622 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
8623 if (unlikely(__pyx_t_2)) {
8632 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
8633 __Pyx_GOTREF(__pyx_t_3);
8634 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8635 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8636 __PYX_ERR(1, 136, __pyx_L1_error)
8654 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
8655 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
8665 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
8666 __Pyx_GOTREF(__pyx_t_5);
8668 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8669 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8670 if (likely(__pyx_t_6)) {
8671 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
8672 __Pyx_INCREF(__pyx_t_6);
8673 __Pyx_INCREF(
function);
8674 __Pyx_DECREF_SET(__pyx_t_5,
function);
8677 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
8678 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8679 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
8680 __Pyx_GOTREF(__pyx_t_3);
8681 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8682 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
8701 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
8702 __pyx_t_3 = __pyx_v_format;
8703 __Pyx_INCREF(__pyx_t_3);
8704 __Pyx_GIVEREF(__pyx_t_3);
8705 __Pyx_GOTREF(__pyx_v_self->_format);
8706 __Pyx_DECREF(__pyx_v_self->_format);
8707 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
8717 if (unlikely(__pyx_v_self->_format == Py_None)) {
8718 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
8719 __PYX_ERR(1, 141, __pyx_L1_error)
8721 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
8722 __pyx_v_self->format = __pyx_t_7;
8731 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
8740 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
8749 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
8750 if (unlikely(__pyx_t_4)) {
8759 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
8760 __Pyx_GOTREF(__pyx_t_3);
8761 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8762 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8763 __PYX_ERR(1, 148, __pyx_L1_error)
8782 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
8784 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
8785 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 8786 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
8788 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
8789 __Pyx_GOTREF(__pyx_t_5);
8791 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
8792 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8793 __pyx_v_dim = __pyx_t_9;
8794 __pyx_v_idx = __pyx_t_8;
8795 __pyx_t_8 = (__pyx_t_8 + 1);
8804 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
8805 if (unlikely(__pyx_t_4)) {
8814 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
8815 __Pyx_GOTREF(__pyx_t_5);
8816 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
8817 __Pyx_GOTREF(__pyx_t_6);
8818 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
8819 __Pyx_GOTREF(__pyx_t_10);
8820 __Pyx_GIVEREF(__pyx_t_5);
8821 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
8822 __Pyx_GIVEREF(__pyx_t_6);
8823 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
8826 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
8827 __Pyx_GOTREF(__pyx_t_6);
8828 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8829 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
8830 __Pyx_GOTREF(__pyx_t_10);
8831 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8832 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8833 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8834 __PYX_ERR(1, 153, __pyx_L1_error)
8852 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
8862 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8871 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
8881 __pyx_v_order =
'F';
8890 __Pyx_INCREF(__pyx_n_u_fortran);
8891 __Pyx_GIVEREF(__pyx_n_u_fortran);
8892 __Pyx_GOTREF(__pyx_v_self->mode);
8893 __Pyx_DECREF(__pyx_v_self->mode);
8894 __pyx_v_self->mode = __pyx_n_u_fortran;
8913 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
8914 if (likely(__pyx_t_4)) {
8923 __pyx_v_order =
'C';
8932 __Pyx_INCREF(__pyx_n_u_c);
8933 __Pyx_GIVEREF(__pyx_n_u_c);
8934 __Pyx_GOTREF(__pyx_v_self->mode);
8935 __Pyx_DECREF(__pyx_v_self->mode);
8936 __pyx_v_self->mode = __pyx_n_u_c;
8956 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
8957 __Pyx_GOTREF(__pyx_t_3);
8958 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
8959 __Pyx_GOTREF(__pyx_t_10);
8960 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8961 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8962 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8963 __PYX_ERR(1, 164, __pyx_L1_error)
8974 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
8983 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
8992 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
8993 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
8994 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8995 __pyx_v_self->dtype_is_object = __pyx_t_4;
9004 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
9014 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
9023 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
9024 if (unlikely(__pyx_t_4)) {
9033 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
9034 __Pyx_GOTREF(__pyx_t_10);
9035 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
9036 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9037 __PYX_ERR(1, 176, __pyx_L1_error)
9055 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
9065 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
9074 if (unlikely(__pyx_v_itemsize == 0)) {
9075 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
9076 __PYX_ERR(1, 180, __pyx_L1_error)
9078 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
9079 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
9080 __PYX_ERR(1, 180, __pyx_L1_error)
9082 __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
9083 __pyx_t_9 = __pyx_t_1;
9084 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
9085 __pyx_v_i = __pyx_t_11;
9094 (__pyx_v_p[__pyx_v_i]) = Py_None;
9136 __Pyx_XDECREF(__pyx_t_3);
9137 __Pyx_XDECREF(__pyx_t_5);
9138 __Pyx_XDECREF(__pyx_t_6);
9139 __Pyx_XDECREF(__pyx_t_10);
9140 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9143 __Pyx_XDECREF(__pyx_v_format);
9144 __Pyx_RefNannyFinishContext();
9157 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
9158 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
9160 __Pyx_RefNannyDeclarations
9161 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
9162 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
9165 __Pyx_RefNannyFinishContext();
9169 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
9170 int __pyx_v_bufmode;
9172 __Pyx_RefNannyDeclarations
9175 PyObject *__pyx_t_3 = NULL;
9177 Py_ssize_t __pyx_t_5;
9179 Py_ssize_t *__pyx_t_7;
9180 if (__pyx_v_info == NULL) {
9181 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
9184 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
9185 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
9186 __Pyx_GIVEREF(__pyx_v_info->obj);
9195 __pyx_v_bufmode = -1;
9204 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
9205 __pyx_t_2 = (__pyx_t_1 != 0);
9215 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
9234 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
9235 __pyx_t_1 = (__pyx_t_2 != 0);
9245 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
9264 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
9265 if (unlikely(__pyx_t_1)) {
9274 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
9275 __Pyx_GOTREF(__pyx_t_3);
9276 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9277 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9278 __PYX_ERR(1, 192, __pyx_L1_error)
9296 __pyx_t_4 = __pyx_v_self->data;
9297 __pyx_v_info->buf = __pyx_t_4;
9306 __pyx_t_5 = __pyx_v_self->len;
9307 __pyx_v_info->len = __pyx_t_5;
9316 __pyx_t_6 = __pyx_v_self->ndim;
9317 __pyx_v_info->ndim = __pyx_t_6;
9326 __pyx_t_7 = __pyx_v_self->_shape;
9327 __pyx_v_info->shape = __pyx_t_7;
9336 __pyx_t_7 = __pyx_v_self->_strides;
9337 __pyx_v_info->strides = __pyx_t_7;
9346 __pyx_v_info->suboffsets = NULL;
9355 __pyx_t_5 = __pyx_v_self->itemsize;
9356 __pyx_v_info->itemsize = __pyx_t_5;
9365 __pyx_v_info->readonly = 0;
9374 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9384 __pyx_t_4 = __pyx_v_self->format;
9385 __pyx_v_info->format = __pyx_t_4;
9405 __pyx_v_info->format = NULL;
9416 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9417 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9418 __Pyx_GOTREF(__pyx_v_info->obj);
9419 __Pyx_DECREF(__pyx_v_info->obj);
9420 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
9434 __Pyx_XDECREF(__pyx_t_3);
9435 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9437 if (__pyx_v_info->obj != NULL) {
9438 __Pyx_GOTREF(__pyx_v_info->obj);
9439 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9443 if (__pyx_v_info->obj == Py_None) {
9444 __Pyx_GOTREF(__pyx_v_info->obj);
9445 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9448 __Pyx_RefNannyFinishContext();
9461 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
9462 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
9463 __Pyx_RefNannyDeclarations
9464 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
9465 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
9468 __Pyx_RefNannyFinishContext();
9471 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
9472 __Pyx_RefNannyDeclarations
9474 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
9483 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
9493 __pyx_v_self->callback_free_data(__pyx_v_self->data);
9512 __pyx_t_1 = (__pyx_v_self->free_data != 0);
9522 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
9532 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
9550 free(__pyx_v_self->data);
9569 PyObject_Free(__pyx_v_self->_shape);
9580 __Pyx_RefNannyFinishContext();
9592 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
9593 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
9594 PyObject *__pyx_r = 0;
9595 __Pyx_RefNannyDeclarations
9596 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
9597 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
9600 __Pyx_RefNannyFinishContext();
9604 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
9605 PyObject *__pyx_r = NULL;
9606 __Pyx_RefNannyDeclarations
9607 PyObject *__pyx_t_1 = NULL;
9608 __Pyx_RefNannySetupContext(
"__get__", 0);
9617 __Pyx_XDECREF(__pyx_r);
9618 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
9619 __Pyx_GOTREF(__pyx_t_1);
9620 __pyx_r = __pyx_t_1;
9634 __Pyx_XDECREF(__pyx_t_1);
9635 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9638 __Pyx_XGIVEREF(__pyx_r);
9639 __Pyx_RefNannyFinishContext();
9651 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
9653 PyObject *__pyx_r = NULL;
9654 __Pyx_RefNannyDeclarations
9655 PyObject *__pyx_t_1 = NULL;
9656 PyObject *__pyx_t_2 = NULL;
9657 PyObject *__pyx_t_3 = NULL;
9658 __Pyx_RefNannySetupContext(
"get_memview", 0);
9667 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
9676 __Pyx_XDECREF(__pyx_r);
9677 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
9678 __Pyx_GOTREF(__pyx_t_1);
9679 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
9680 __Pyx_GOTREF(__pyx_t_2);
9681 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
9682 __Pyx_GOTREF(__pyx_t_3);
9683 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9684 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9685 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
9686 __Pyx_GIVEREF(__pyx_t_1);
9687 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
9688 __Pyx_GIVEREF(__pyx_t_2);
9689 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
9692 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
9693 __Pyx_GOTREF(__pyx_t_2);
9694 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9695 __pyx_r = __pyx_t_2;
9709 __Pyx_XDECREF(__pyx_t_1);
9710 __Pyx_XDECREF(__pyx_t_2);
9711 __Pyx_XDECREF(__pyx_t_3);
9712 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
9715 __Pyx_XGIVEREF(__pyx_r);
9716 __Pyx_RefNannyFinishContext();
9729 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
9730 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
9732 __Pyx_RefNannyDeclarations
9733 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
9734 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
9737 __Pyx_RefNannyFinishContext();
9741 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
9743 __Pyx_RefNannyDeclarations
9744 __Pyx_RefNannySetupContext(
"__len__", 0);
9753 __pyx_r = (__pyx_v_self->_shape[0]);
9766 __Pyx_RefNannyFinishContext();
9779 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
9780 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
9781 PyObject *__pyx_r = 0;
9782 __Pyx_RefNannyDeclarations
9783 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
9784 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
9787 __Pyx_RefNannyFinishContext();
9791 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
9792 PyObject *__pyx_r = NULL;
9793 __Pyx_RefNannyDeclarations
9794 PyObject *__pyx_t_1 = NULL;
9795 PyObject *__pyx_t_2 = NULL;
9796 __Pyx_RefNannySetupContext(
"__getattr__", 0);
9805 __Pyx_XDECREF(__pyx_r);
9806 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
9807 __Pyx_GOTREF(__pyx_t_1);
9808 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
9809 __Pyx_GOTREF(__pyx_t_2);
9810 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9811 __pyx_r = __pyx_t_2;
9825 __Pyx_XDECREF(__pyx_t_1);
9826 __Pyx_XDECREF(__pyx_t_2);
9827 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9830 __Pyx_XGIVEREF(__pyx_r);
9831 __Pyx_RefNannyFinishContext();
9844 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
9845 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
9846 PyObject *__pyx_r = 0;
9847 __Pyx_RefNannyDeclarations
9848 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
9849 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
9852 __Pyx_RefNannyFinishContext();
9856 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
9857 PyObject *__pyx_r = NULL;
9858 __Pyx_RefNannyDeclarations
9859 PyObject *__pyx_t_1 = NULL;
9860 PyObject *__pyx_t_2 = NULL;
9861 __Pyx_RefNannySetupContext(
"__getitem__", 0);
9870 __Pyx_XDECREF(__pyx_r);
9871 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
9872 __Pyx_GOTREF(__pyx_t_1);
9873 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
9874 __Pyx_GOTREF(__pyx_t_2);
9875 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9876 __pyx_r = __pyx_t_2;
9890 __Pyx_XDECREF(__pyx_t_1);
9891 __Pyx_XDECREF(__pyx_t_2);
9892 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9895 __Pyx_XGIVEREF(__pyx_r);
9896 __Pyx_RefNannyFinishContext();
9909 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
9910 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9912 __Pyx_RefNannyDeclarations
9913 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
9914 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
9917 __Pyx_RefNannyFinishContext();
9921 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9923 __Pyx_RefNannyDeclarations
9924 PyObject *__pyx_t_1 = NULL;
9925 __Pyx_RefNannySetupContext(
"__setitem__", 0);
9934 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
9935 __Pyx_GOTREF(__pyx_t_1);
9936 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
9937 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9951 __Pyx_XDECREF(__pyx_t_1);
9952 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9955 __Pyx_RefNannyFinishContext();
9966 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
9967 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9968 PyObject *__pyx_r = 0;
9969 __Pyx_RefNannyDeclarations
9970 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
9971 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
9974 __Pyx_RefNannyFinishContext();
9978 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
9979 PyObject *__pyx_r = NULL;
9980 __Pyx_RefNannyDeclarations
9981 PyObject *__pyx_t_1 = NULL;
9982 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
9990 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
9991 __Pyx_GOTREF(__pyx_t_1);
9992 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9993 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9994 __PYX_ERR(1, 2, __pyx_L1_error)
10004 __Pyx_XDECREF(__pyx_t_1);
10005 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10007 __Pyx_XGIVEREF(__pyx_r);
10008 __Pyx_RefNannyFinishContext();
10020 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
10021 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10022 PyObject *__pyx_r = 0;
10023 __Pyx_RefNannyDeclarations
10024 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
10025 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10028 __Pyx_RefNannyFinishContext();
10032 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
10033 PyObject *__pyx_r = NULL;
10034 __Pyx_RefNannyDeclarations
10035 PyObject *__pyx_t_1 = NULL;
10036 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
10043 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
10044 __Pyx_GOTREF(__pyx_t_1);
10045 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10046 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10047 __PYX_ERR(1, 4, __pyx_L1_error)
10058 __Pyx_XDECREF(__pyx_t_1);
10059 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10061 __Pyx_XGIVEREF(__pyx_r);
10062 __Pyx_RefNannyFinishContext();
10074 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
10075 struct __pyx_array_obj *__pyx_v_result = 0;
10076 struct __pyx_array_obj *__pyx_r = NULL;
10077 __Pyx_RefNannyDeclarations
10079 PyObject *__pyx_t_2 = NULL;
10080 PyObject *__pyx_t_3 = NULL;
10081 PyObject *__pyx_t_4 = NULL;
10082 PyObject *__pyx_t_5 = NULL;
10083 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
10092 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
10102 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
10103 __Pyx_GOTREF(__pyx_t_2);
10104 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
10105 __Pyx_GOTREF(__pyx_t_3);
10106 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
10107 __Pyx_GOTREF(__pyx_t_4);
10108 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
10109 __Pyx_GOTREF(__pyx_t_5);
10110 __Pyx_INCREF(__pyx_v_shape);
10111 __Pyx_GIVEREF(__pyx_v_shape);
10112 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
10113 __Pyx_GIVEREF(__pyx_t_2);
10114 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
10115 __Pyx_GIVEREF(__pyx_t_3);
10116 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
10117 __Pyx_GIVEREF(__pyx_t_4);
10118 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
10122 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
10123 __Pyx_GOTREF(__pyx_t_4);
10124 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10125 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
10146 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
10147 __Pyx_GOTREF(__pyx_t_4);
10148 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
10149 __Pyx_GOTREF(__pyx_t_5);
10150 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
10151 __Pyx_GOTREF(__pyx_t_3);
10152 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
10153 __Pyx_GOTREF(__pyx_t_2);
10154 __Pyx_INCREF(__pyx_v_shape);
10155 __Pyx_GIVEREF(__pyx_v_shape);
10156 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
10157 __Pyx_GIVEREF(__pyx_t_4);
10158 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
10159 __Pyx_GIVEREF(__pyx_t_5);
10160 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
10161 __Pyx_GIVEREF(__pyx_t_3);
10162 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
10174 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
10175 __Pyx_GOTREF(__pyx_t_3);
10176 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
10185 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
10186 __Pyx_GOTREF(__pyx_t_5);
10187 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10188 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10189 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
10199 __pyx_v_result->data = __pyx_v_buf;
10210 __Pyx_XDECREF(((PyObject *)__pyx_r));
10211 __Pyx_INCREF(((PyObject *)__pyx_v_result));
10212 __pyx_r = __pyx_v_result;
10225 __Pyx_XDECREF(__pyx_t_2);
10226 __Pyx_XDECREF(__pyx_t_3);
10227 __Pyx_XDECREF(__pyx_t_4);
10228 __Pyx_XDECREF(__pyx_t_5);
10229 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
10232 __Pyx_XDECREF((PyObject *)__pyx_v_result);
10233 __Pyx_XGIVEREF((PyObject *)__pyx_r);
10234 __Pyx_RefNannyFinishContext();
10247 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
10248 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10249 PyObject *__pyx_v_name = 0;
10251 __Pyx_RefNannyDeclarations
10252 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
10254 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
10255 PyObject* values[1] = {0};
10256 if (unlikely(__pyx_kwds)) {
10257 Py_ssize_t kw_args;
10258 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10259 switch (pos_args) {
10260 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10261 CYTHON_FALLTHROUGH;
10263 default:
goto __pyx_L5_argtuple_error;
10265 kw_args = PyDict_Size(__pyx_kwds);
10266 switch (pos_args) {
10268 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
10269 else goto __pyx_L5_argtuple_error;
10271 if (unlikely(kw_args > 0)) {
10272 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
10274 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
10275 goto __pyx_L5_argtuple_error;
10277 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10279 __pyx_v_name = values[0];
10281 goto __pyx_L4_argument_unpacking_done;
10282 __pyx_L5_argtuple_error:;
10283 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
10285 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10286 __Pyx_RefNannyFinishContext();
10288 __pyx_L4_argument_unpacking_done:;
10289 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
10292 __Pyx_RefNannyFinishContext();
10296 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
10298 __Pyx_RefNannyDeclarations
10299 __Pyx_RefNannySetupContext(
"__init__", 0);
10308 __Pyx_INCREF(__pyx_v_name);
10309 __Pyx_GIVEREF(__pyx_v_name);
10310 __Pyx_GOTREF(__pyx_v_self->name);
10311 __Pyx_DECREF(__pyx_v_self->name);
10312 __pyx_v_self->name = __pyx_v_name;
10324 __Pyx_RefNannyFinishContext();
10337 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
10338 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
10339 PyObject *__pyx_r = 0;
10340 __Pyx_RefNannyDeclarations
10341 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
10342 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
10345 __Pyx_RefNannyFinishContext();
10349 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
10350 PyObject *__pyx_r = NULL;
10351 __Pyx_RefNannyDeclarations
10352 __Pyx_RefNannySetupContext(
"__repr__", 0);
10361 __Pyx_XDECREF(__pyx_r);
10362 __Pyx_INCREF(__pyx_v_self->name);
10363 __pyx_r = __pyx_v_self->name;
10376 __Pyx_XGIVEREF(__pyx_r);
10377 __Pyx_RefNannyFinishContext();
10388 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
10389 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10390 PyObject *__pyx_r = 0;
10391 __Pyx_RefNannyDeclarations
10392 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
10393 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
10396 __Pyx_RefNannyFinishContext();
10400 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
10401 PyObject *__pyx_v_state = 0;
10402 PyObject *__pyx_v__dict = 0;
10403 int __pyx_v_use_setstate;
10404 PyObject *__pyx_r = NULL;
10405 __Pyx_RefNannyDeclarations
10406 PyObject *__pyx_t_1 = NULL;
10409 PyObject *__pyx_t_4 = NULL;
10410 PyObject *__pyx_t_5 = NULL;
10411 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
10420 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
10421 __Pyx_GOTREF(__pyx_t_1);
10422 __Pyx_INCREF(__pyx_v_self->name);
10423 __Pyx_GIVEREF(__pyx_v_self->name);
10424 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
10425 __pyx_v_state = ((PyObject*)__pyx_t_1);
10435 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
10436 __Pyx_GOTREF(__pyx_t_1);
10437 __pyx_v__dict = __pyx_t_1;
10447 __pyx_t_2 = (__pyx_v__dict != Py_None);
10448 __pyx_t_3 = (__pyx_t_2 != 0);
10458 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
10459 __Pyx_GOTREF(__pyx_t_1);
10460 __Pyx_INCREF(__pyx_v__dict);
10461 __Pyx_GIVEREF(__pyx_v__dict);
10462 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
10463 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
10464 __Pyx_GOTREF(__pyx_t_4);
10465 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10466 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
10476 __pyx_v_use_setstate = 1;
10496 __pyx_t_3 = (__pyx_v_self->name != Py_None);
10497 __pyx_v_use_setstate = __pyx_t_3;
10508 __pyx_t_3 = (__pyx_v_use_setstate != 0);
10518 __Pyx_XDECREF(__pyx_r);
10519 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
10520 __Pyx_GOTREF(__pyx_t_4);
10521 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
10522 __Pyx_GOTREF(__pyx_t_1);
10523 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10524 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10525 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10526 __Pyx_INCREF(__pyx_int_184977713);
10527 __Pyx_GIVEREF(__pyx_int_184977713);
10528 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
10529 __Pyx_INCREF(Py_None);
10530 __Pyx_GIVEREF(Py_None);
10531 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
10532 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
10533 __Pyx_GOTREF(__pyx_t_5);
10534 __Pyx_GIVEREF(__pyx_t_4);
10535 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10536 __Pyx_GIVEREF(__pyx_t_1);
10537 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
10538 __Pyx_INCREF(__pyx_v_state);
10539 __Pyx_GIVEREF(__pyx_v_state);
10540 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
10543 __pyx_r = __pyx_t_5;
10564 __Pyx_XDECREF(__pyx_r);
10565 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
10566 __Pyx_GOTREF(__pyx_t_5);
10567 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
10568 __Pyx_GOTREF(__pyx_t_1);
10569 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10570 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10571 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10572 __Pyx_INCREF(__pyx_int_184977713);
10573 __Pyx_GIVEREF(__pyx_int_184977713);
10574 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
10575 __Pyx_INCREF(__pyx_v_state);
10576 __Pyx_GIVEREF(__pyx_v_state);
10577 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
10578 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
10579 __Pyx_GOTREF(__pyx_t_4);
10580 __Pyx_GIVEREF(__pyx_t_5);
10581 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
10582 __Pyx_GIVEREF(__pyx_t_1);
10583 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
10586 __pyx_r = __pyx_t_4;
10599 __Pyx_XDECREF(__pyx_t_1);
10600 __Pyx_XDECREF(__pyx_t_4);
10601 __Pyx_XDECREF(__pyx_t_5);
10602 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10605 __Pyx_XDECREF(__pyx_v_state);
10606 __Pyx_XDECREF(__pyx_v__dict);
10607 __Pyx_XGIVEREF(__pyx_r);
10608 __Pyx_RefNannyFinishContext();
10620 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
10621 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10622 PyObject *__pyx_r = 0;
10623 __Pyx_RefNannyDeclarations
10624 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
10625 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10628 __Pyx_RefNannyFinishContext();
10632 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10633 PyObject *__pyx_r = NULL;
10634 __Pyx_RefNannyDeclarations
10635 PyObject *__pyx_t_1 = NULL;
10636 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
10643 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
10644 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
10645 __Pyx_GOTREF(__pyx_t_1);
10646 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10656 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10659 __Pyx_XDECREF(__pyx_t_1);
10660 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10663 __Pyx_XGIVEREF(__pyx_r);
10664 __Pyx_RefNannyFinishContext();
10676 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
10677 Py_intptr_t __pyx_v_aligned_p;
10678 size_t __pyx_v_offset;
10689 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
10698 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
10707 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
10717 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
10735 __pyx_r = ((
void *)__pyx_v_aligned_p);
10760 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
10761 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10762 PyObject *__pyx_v_obj = 0;
10764 int __pyx_v_dtype_is_object;
10766 __Pyx_RefNannyDeclarations
10767 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
10769 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
10770 PyObject* values[3] = {0,0,0};
10771 if (unlikely(__pyx_kwds)) {
10772 Py_ssize_t kw_args;
10773 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10774 switch (pos_args) {
10775 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10776 CYTHON_FALLTHROUGH;
10777 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10778 CYTHON_FALLTHROUGH;
10779 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10780 CYTHON_FALLTHROUGH;
10782 default:
goto __pyx_L5_argtuple_error;
10784 kw_args = PyDict_Size(__pyx_kwds);
10785 switch (pos_args) {
10787 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
10788 else goto __pyx_L5_argtuple_error;
10789 CYTHON_FALLTHROUGH;
10791 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
10793 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
10795 CYTHON_FALLTHROUGH;
10798 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
10799 if (value) { values[2] = value; kw_args--; }
10802 if (unlikely(kw_args > 0)) {
10803 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
10806 switch (PyTuple_GET_SIZE(__pyx_args)) {
10807 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10808 CYTHON_FALLTHROUGH;
10809 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10810 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10812 default:
goto __pyx_L5_argtuple_error;
10815 __pyx_v_obj = values[0];
10816 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
10818 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
10820 __pyx_v_dtype_is_object = ((int)0);
10823 goto __pyx_L4_argument_unpacking_done;
10824 __pyx_L5_argtuple_error:;
10825 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
10827 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10828 __Pyx_RefNannyFinishContext();
10830 __pyx_L4_argument_unpacking_done:;
10831 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
10834 __Pyx_RefNannyFinishContext();
10838 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
10840 __Pyx_RefNannyDeclarations
10845 __Pyx_RefNannySetupContext(
"__cinit__", 0);
10854 __Pyx_INCREF(__pyx_v_obj);
10855 __Pyx_GIVEREF(__pyx_v_obj);
10856 __Pyx_GOTREF(__pyx_v_self->obj);
10857 __Pyx_DECREF(__pyx_v_self->obj);
10858 __pyx_v_self->obj = __pyx_v_obj;
10867 __pyx_v_self->flags = __pyx_v_flags;
10876 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
10877 __pyx_t_3 = (__pyx_t_2 != 0);
10880 __pyx_t_1 = __pyx_t_3;
10881 goto __pyx_L4_bool_binop_done;
10883 __pyx_t_3 = (__pyx_v_obj != Py_None);
10884 __pyx_t_2 = (__pyx_t_3 != 0);
10885 __pyx_t_1 = __pyx_t_2;
10886 __pyx_L4_bool_binop_done:;
10896 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
10905 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
10915 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
10924 Py_INCREF(Py_None);
10951 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
10961 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10970 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
10988 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10998 __pyx_v_self->lock = PyThread_allocate_lock();
11007 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
11008 if (unlikely(__pyx_t_1)) {
11017 PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
11044 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
11054 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
11057 __pyx_t_1 = __pyx_t_2;
11058 goto __pyx_L11_bool_binop_done;
11060 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
11061 __pyx_t_1 = __pyx_t_2;
11062 __pyx_L11_bool_binop_done:;
11063 __pyx_v_self->dtype_is_object = __pyx_t_1;
11083 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
11094 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
11103 __pyx_v_self->typeinfo = NULL;
11117 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11120 __Pyx_RefNannyFinishContext();
11133 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
11134 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
11135 __Pyx_RefNannyDeclarations
11136 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
11137 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11140 __Pyx_RefNannyFinishContext();
11143 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11145 __Pyx_RefNannyDeclarations
11151 PyThread_type_lock __pyx_t_6;
11152 PyThread_type_lock __pyx_t_7;
11153 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
11162 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
11163 __pyx_t_2 = (__pyx_t_1 != 0);
11173 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
11192 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
11202 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
11211 Py_DECREF(Py_None);
11230 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
11240 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
11241 __pyx_t_4 = __pyx_t_3;
11242 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
11243 __pyx_v_i = __pyx_t_5;
11252 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
11262 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
11271 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
11281 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
11282 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
11291 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
11292 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
11310 goto __pyx_L6_break;
11330 PyThread_free_lock(__pyx_v_self->lock);
11352 __Pyx_RefNannyFinishContext();
11363 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
11364 Py_ssize_t __pyx_v_dim;
11365 char *__pyx_v_itemp;
11366 PyObject *__pyx_v_idx = NULL;
11368 __Pyx_RefNannyDeclarations
11369 Py_ssize_t __pyx_t_1;
11370 PyObject *__pyx_t_2 = NULL;
11371 Py_ssize_t __pyx_t_3;
11372 PyObject *(*__pyx_t_4)(PyObject *);
11373 PyObject *__pyx_t_5 = NULL;
11374 Py_ssize_t __pyx_t_6;
11376 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
11385 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
11395 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
11396 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
11399 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
11400 __Pyx_GOTREF(__pyx_t_2);
11401 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
11404 if (likely(!__pyx_t_4)) {
11405 if (likely(PyList_CheckExact(__pyx_t_2))) {
11406 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
11407 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 11408 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
11410 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
11411 __Pyx_GOTREF(__pyx_t_5);
11414 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
11415 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 11416 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
11418 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
11419 __Pyx_GOTREF(__pyx_t_5);
11423 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
11424 if (unlikely(!__pyx_t_5)) {
11425 PyObject* exc_type = PyErr_Occurred();
11427 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11428 else __PYX_ERR(1, 397, __pyx_L1_error)
11432 __Pyx_GOTREF(__pyx_t_5);
11434 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
11436 __pyx_v_dim = __pyx_t_1;
11437 __pyx_t_1 = (__pyx_t_1 + 1);
11446 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
11447 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
11448 __pyx_v_itemp = __pyx_t_7;
11458 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11467 __pyx_r = __pyx_v_itemp;
11480 __Pyx_XDECREF(__pyx_t_2);
11481 __Pyx_XDECREF(__pyx_t_5);
11482 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
11485 __Pyx_XDECREF(__pyx_v_idx);
11486 __Pyx_RefNannyFinishContext();
11499 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
11500 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
11501 PyObject *__pyx_r = 0;
11502 __Pyx_RefNannyDeclarations
11503 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
11504 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
11507 __Pyx_RefNannyFinishContext();
11511 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
11512 PyObject *__pyx_v_have_slices = NULL;
11513 PyObject *__pyx_v_indices = NULL;
11514 char *__pyx_v_itemp;
11515 PyObject *__pyx_r = NULL;
11516 __Pyx_RefNannyDeclarations
11519 PyObject *__pyx_t_3 = NULL;
11520 PyObject *__pyx_t_4 = NULL;
11521 PyObject *__pyx_t_5 = NULL;
11523 __Pyx_RefNannySetupContext(
"__getitem__", 0);
11532 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
11533 __pyx_t_2 = (__pyx_t_1 != 0);
11543 __Pyx_XDECREF(__pyx_r);
11544 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11545 __pyx_r = ((PyObject *)__pyx_v_self);
11564 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
11565 __Pyx_GOTREF(__pyx_t_3);
11566 if (likely(__pyx_t_3 != Py_None)) {
11567 PyObject* sequence = __pyx_t_3;
11568 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11569 if (unlikely(size != 2)) {
11570 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11571 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11572 __PYX_ERR(1, 407, __pyx_L1_error)
11574 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 11575 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
11576 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
11577 __Pyx_INCREF(__pyx_t_4);
11578 __Pyx_INCREF(__pyx_t_5);
11580 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
11581 __Pyx_GOTREF(__pyx_t_4);
11582 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
11583 __Pyx_GOTREF(__pyx_t_5);
11585 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11587 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
11589 __pyx_v_have_slices = __pyx_t_4;
11591 __pyx_v_indices = __pyx_t_5;
11601 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
11611 __Pyx_XDECREF(__pyx_r);
11612 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
11613 __Pyx_GOTREF(__pyx_t_3);
11614 __pyx_r = __pyx_t_3;
11635 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
11636 __pyx_v_itemp = __pyx_t_6;
11645 __Pyx_XDECREF(__pyx_r);
11646 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
11647 __Pyx_GOTREF(__pyx_t_3);
11648 __pyx_r = __pyx_t_3;
11663 __Pyx_XDECREF(__pyx_t_3);
11664 __Pyx_XDECREF(__pyx_t_4);
11665 __Pyx_XDECREF(__pyx_t_5);
11666 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11669 __Pyx_XDECREF(__pyx_v_have_slices);
11670 __Pyx_XDECREF(__pyx_v_indices);
11671 __Pyx_XGIVEREF(__pyx_r);
11672 __Pyx_RefNannyFinishContext();
11685 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
11686 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11688 __Pyx_RefNannyDeclarations
11689 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
11690 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
11693 __Pyx_RefNannyFinishContext();
11697 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11698 PyObject *__pyx_v_have_slices = NULL;
11699 PyObject *__pyx_v_obj = NULL;
11701 __Pyx_RefNannyDeclarations
11703 PyObject *__pyx_t_2 = NULL;
11704 PyObject *__pyx_t_3 = NULL;
11705 PyObject *__pyx_t_4 = NULL;
11706 __Pyx_RefNannySetupContext(
"__setitem__", 0);
11707 __Pyx_INCREF(__pyx_v_index);
11716 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
11717 if (unlikely(__pyx_t_1)) {
11726 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
11727 __Pyx_GOTREF(__pyx_t_2);
11728 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11729 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11730 __PYX_ERR(1, 418, __pyx_L1_error)
11748 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
11749 __Pyx_GOTREF(__pyx_t_2);
11750 if (likely(__pyx_t_2 != Py_None)) {
11751 PyObject* sequence = __pyx_t_2;
11752 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11753 if (unlikely(size != 2)) {
11754 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11755 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11756 __PYX_ERR(1, 420, __pyx_L1_error)
11758 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 11759 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
11760 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
11761 __Pyx_INCREF(__pyx_t_3);
11762 __Pyx_INCREF(__pyx_t_4);
11764 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
11765 __Pyx_GOTREF(__pyx_t_3);
11766 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
11767 __Pyx_GOTREF(__pyx_t_4);
11769 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11771 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
11773 __pyx_v_have_slices = __pyx_t_3;
11775 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
11785 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
11795 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
11796 __Pyx_GOTREF(__pyx_t_2);
11797 __pyx_v_obj = __pyx_t_2;
11807 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
11817 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
11818 __Pyx_GOTREF(__pyx_t_2);
11819 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
11820 __Pyx_GOTREF(__pyx_t_4);
11821 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11822 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11842 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
11843 __Pyx_GOTREF(__pyx_t_4);
11844 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
11845 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
11846 __Pyx_GOTREF(__pyx_t_2);
11847 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11848 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11870 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
11871 __Pyx_GOTREF(__pyx_t_2);
11872 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11888 __Pyx_XDECREF(__pyx_t_2);
11889 __Pyx_XDECREF(__pyx_t_3);
11890 __Pyx_XDECREF(__pyx_t_4);
11891 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11894 __Pyx_XDECREF(__pyx_v_have_slices);
11895 __Pyx_XDECREF(__pyx_v_obj);
11896 __Pyx_XDECREF(__pyx_v_index);
11897 __Pyx_RefNannyFinishContext();
11909 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
11910 PyObject *__pyx_r = NULL;
11911 __Pyx_RefNannyDeclarations
11914 PyObject *__pyx_t_3 = NULL;
11915 PyObject *__pyx_t_4 = NULL;
11916 PyObject *__pyx_t_5 = NULL;
11917 PyObject *__pyx_t_6 = NULL;
11918 PyObject *__pyx_t_7 = NULL;
11919 PyObject *__pyx_t_8 = NULL;
11921 __Pyx_RefNannySetupContext(
"is_slice", 0);
11922 __Pyx_INCREF(__pyx_v_obj);
11931 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
11932 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
11943 __Pyx_PyThreadState_declare
11944 __Pyx_PyThreadState_assign
11945 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
11946 __Pyx_XGOTREF(__pyx_t_3);
11947 __Pyx_XGOTREF(__pyx_t_4);
11948 __Pyx_XGOTREF(__pyx_t_5);
11958 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
11959 __Pyx_GOTREF(__pyx_t_6);
11968 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
11969 __Pyx_GOTREF(__pyx_t_7);
11978 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
11979 __Pyx_GOTREF(__pyx_t_8);
11980 __Pyx_INCREF(__pyx_v_obj);
11981 __Pyx_GIVEREF(__pyx_v_obj);
11982 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
11983 __Pyx_GIVEREF(__pyx_t_6);
11984 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
11985 __Pyx_GIVEREF(__pyx_t_7);
11986 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
11989 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
11990 __Pyx_GOTREF(__pyx_t_7);
11991 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11992 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
12003 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12004 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12005 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12006 goto __pyx_L9_try_end;
12008 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12009 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12010 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
12019 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
12021 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12022 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
12023 __Pyx_GOTREF(__pyx_t_7);
12024 __Pyx_GOTREF(__pyx_t_8);
12025 __Pyx_GOTREF(__pyx_t_6);
12034 __Pyx_XDECREF(__pyx_r);
12035 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12036 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12037 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12038 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12039 goto __pyx_L7_except_return;
12041 goto __pyx_L6_except_error;
12042 __pyx_L6_except_error:;
12051 __Pyx_XGIVEREF(__pyx_t_3);
12052 __Pyx_XGIVEREF(__pyx_t_4);
12053 __Pyx_XGIVEREF(__pyx_t_5);
12054 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12055 goto __pyx_L1_error;
12056 __pyx_L7_except_return:;
12057 __Pyx_XGIVEREF(__pyx_t_3);
12058 __Pyx_XGIVEREF(__pyx_t_4);
12059 __Pyx_XGIVEREF(__pyx_t_5);
12060 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12081 __Pyx_XDECREF(__pyx_r);
12082 __Pyx_INCREF(__pyx_v_obj);
12083 __pyx_r = __pyx_v_obj;
12096 __Pyx_XDECREF(__pyx_t_6);
12097 __Pyx_XDECREF(__pyx_t_7);
12098 __Pyx_XDECREF(__pyx_t_8);
12099 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12102 __Pyx_XDECREF(__pyx_v_obj);
12103 __Pyx_XGIVEREF(__pyx_r);
12104 __Pyx_RefNannyFinishContext();
12116 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
12117 __Pyx_memviewslice __pyx_v_dst_slice;
12118 __Pyx_memviewslice __pyx_v_src_slice;
12119 PyObject *__pyx_r = NULL;
12120 __Pyx_RefNannyDeclarations
12121 __Pyx_memviewslice *__pyx_t_1;
12122 __Pyx_memviewslice *__pyx_t_2;
12123 PyObject *__pyx_t_3 = NULL;
12127 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
12136 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
12137 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 445, __pyx_L1_error)
12146 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
12147 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 446, __pyx_L1_error)
12156 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
12157 __Pyx_GOTREF(__pyx_t_3);
12158 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
12159 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12160 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
12161 __Pyx_GOTREF(__pyx_t_3);
12162 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
12163 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12172 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
12183 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12186 __Pyx_XDECREF(__pyx_t_3);
12187 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
12190 __Pyx_XGIVEREF(__pyx_r);
12191 __Pyx_RefNannyFinishContext();
12203 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
12204 int __pyx_v_array[0x80];
12206 void *__pyx_v_item;
12207 __Pyx_memviewslice *__pyx_v_dst_slice;
12208 __Pyx_memviewslice __pyx_v_tmp_slice;
12209 PyObject *__pyx_r = NULL;
12210 __Pyx_RefNannyDeclarations
12211 __Pyx_memviewslice *__pyx_t_1;
12213 PyObject *__pyx_t_3 = NULL;
12216 char const *__pyx_t_6;
12217 PyObject *__pyx_t_7 = NULL;
12218 PyObject *__pyx_t_8 = NULL;
12219 PyObject *__pyx_t_9 = NULL;
12220 PyObject *__pyx_t_10 = NULL;
12221 PyObject *__pyx_t_11 = NULL;
12222 PyObject *__pyx_t_12 = NULL;
12223 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
12232 __pyx_v_tmp = NULL;
12241 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 456, __pyx_L1_error)
12242 __pyx_v_dst_slice = __pyx_t_1;
12251 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
12261 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
12270 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
12271 if (unlikely(__pyx_t_2)) {
12280 PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
12298 __pyx_v_item = __pyx_v_tmp;
12318 __pyx_v_item = ((
void *)__pyx_v_array);
12338 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
12348 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
12368 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 470, __pyx_L6_error)
12369 __Pyx_GOTREF(__pyx_t_3);
12370 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12381 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
12391 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
12392 __Pyx_GOTREF(__pyx_t_3);
12393 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12411 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
12423 PyMem_Free(__pyx_v_tmp);
12428 __Pyx_PyThreadState_declare
12429 __Pyx_PyThreadState_assign
12430 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
12431 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12432 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
12433 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
12434 __Pyx_XGOTREF(__pyx_t_7);
12435 __Pyx_XGOTREF(__pyx_t_8);
12436 __Pyx_XGOTREF(__pyx_t_9);
12437 __Pyx_XGOTREF(__pyx_t_10);
12438 __Pyx_XGOTREF(__pyx_t_11);
12439 __Pyx_XGOTREF(__pyx_t_12);
12440 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
12442 PyMem_Free(__pyx_v_tmp);
12444 if (PY_MAJOR_VERSION >= 3) {
12445 __Pyx_XGIVEREF(__pyx_t_10);
12446 __Pyx_XGIVEREF(__pyx_t_11);
12447 __Pyx_XGIVEREF(__pyx_t_12);
12448 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
12450 __Pyx_XGIVEREF(__pyx_t_7);
12451 __Pyx_XGIVEREF(__pyx_t_8);
12452 __Pyx_XGIVEREF(__pyx_t_9);
12453 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
12454 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
12455 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
12456 goto __pyx_L1_error;
12470 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12473 __Pyx_XDECREF(__pyx_t_3);
12474 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
12477 __Pyx_XGIVEREF(__pyx_r);
12478 __Pyx_RefNannyFinishContext();
12490 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
12491 char *__pyx_v_itemp;
12492 PyObject *__pyx_r = NULL;
12493 __Pyx_RefNannyDeclarations
12495 PyObject *__pyx_t_2 = NULL;
12496 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
12505 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
12506 __pyx_v_itemp = __pyx_t_1;
12515 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
12516 __Pyx_GOTREF(__pyx_t_2);
12517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12528 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12531 __Pyx_XDECREF(__pyx_t_2);
12532 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
12535 __Pyx_XGIVEREF(__pyx_r);
12536 __Pyx_RefNannyFinishContext();
12548 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
12549 PyObject *__pyx_v_struct = NULL;
12550 PyObject *__pyx_v_bytesitem = 0;
12551 PyObject *__pyx_v_result = NULL;
12552 PyObject *__pyx_r = NULL;
12553 __Pyx_RefNannyDeclarations
12554 PyObject *__pyx_t_1 = NULL;
12555 PyObject *__pyx_t_2 = NULL;
12556 PyObject *__pyx_t_3 = NULL;
12557 PyObject *__pyx_t_4 = NULL;
12558 PyObject *__pyx_t_5 = NULL;
12559 PyObject *__pyx_t_6 = NULL;
12560 PyObject *__pyx_t_7 = NULL;
12562 PyObject *__pyx_t_9 = NULL;
12565 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
12574 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
12575 __Pyx_GOTREF(__pyx_t_1);
12576 __pyx_v_struct = __pyx_t_1;
12586 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
12587 __Pyx_GOTREF(__pyx_t_1);
12588 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
12599 __Pyx_PyThreadState_declare
12600 __Pyx_PyThreadState_assign
12601 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
12602 __Pyx_XGOTREF(__pyx_t_2);
12603 __Pyx_XGOTREF(__pyx_t_3);
12604 __Pyx_XGOTREF(__pyx_t_4);
12614 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
12615 __Pyx_GOTREF(__pyx_t_5);
12616 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
12617 __Pyx_GOTREF(__pyx_t_6);
12620 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
12621 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
12622 if (likely(__pyx_t_7)) {
12623 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
12624 __Pyx_INCREF(__pyx_t_7);
12625 __Pyx_INCREF(
function);
12626 __Pyx_DECREF_SET(__pyx_t_5,
function);
12630 #if CYTHON_FAST_PYCALL 12631 if (PyFunction_Check(__pyx_t_5)) {
12632 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
12633 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
12634 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12635 __Pyx_GOTREF(__pyx_t_1);
12636 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12639 #if CYTHON_FAST_PYCCALL 12640 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
12641 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
12642 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
12643 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12644 __Pyx_GOTREF(__pyx_t_1);
12645 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12649 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
12650 __Pyx_GOTREF(__pyx_t_9);
12652 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
12654 __Pyx_GIVEREF(__pyx_t_6);
12655 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
12656 __Pyx_INCREF(__pyx_v_bytesitem);
12657 __Pyx_GIVEREF(__pyx_v_bytesitem);
12658 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
12660 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
12661 __Pyx_GOTREF(__pyx_t_1);
12662 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12664 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12665 __pyx_v_result = __pyx_t_1;
12685 __pyx_t_10 = strlen(__pyx_v_self->view.format);
12686 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
12696 __Pyx_XDECREF(__pyx_r);
12697 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
12698 __Pyx_GOTREF(__pyx_t_1);
12699 __pyx_r = __pyx_t_1;
12701 goto __pyx_L6_except_return;
12719 __Pyx_XDECREF(__pyx_r);
12720 __Pyx_INCREF(__pyx_v_result);
12721 __pyx_r = __pyx_v_result;
12722 goto __pyx_L6_except_return;
12725 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12726 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12727 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12728 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12729 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
12738 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
12739 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
12740 __Pyx_GOTREF(__pyx_t_6);
12741 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
12742 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12743 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
12744 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
12746 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12747 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
12748 __Pyx_GOTREF(__pyx_t_9);
12749 __Pyx_GOTREF(__pyx_t_5);
12750 __Pyx_GOTREF(__pyx_t_1);
12759 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
12760 __Pyx_GOTREF(__pyx_t_6);
12761 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
12762 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12763 __PYX_ERR(1, 495, __pyx_L5_except_error)
12765 goto __pyx_L5_except_error;
12766 __pyx_L5_except_error:;
12775 __Pyx_XGIVEREF(__pyx_t_2);
12776 __Pyx_XGIVEREF(__pyx_t_3);
12777 __Pyx_XGIVEREF(__pyx_t_4);
12778 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12779 goto __pyx_L1_error;
12780 __pyx_L6_except_return:;
12781 __Pyx_XGIVEREF(__pyx_t_2);
12782 __Pyx_XGIVEREF(__pyx_t_3);
12783 __Pyx_XGIVEREF(__pyx_t_4);
12784 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12798 __Pyx_XDECREF(__pyx_t_1);
12799 __Pyx_XDECREF(__pyx_t_5);
12800 __Pyx_XDECREF(__pyx_t_6);
12801 __Pyx_XDECREF(__pyx_t_7);
12802 __Pyx_XDECREF(__pyx_t_9);
12803 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12806 __Pyx_XDECREF(__pyx_v_struct);
12807 __Pyx_XDECREF(__pyx_v_bytesitem);
12808 __Pyx_XDECREF(__pyx_v_result);
12809 __Pyx_XGIVEREF(__pyx_r);
12810 __Pyx_RefNannyFinishContext();
12822 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
12823 PyObject *__pyx_v_struct = NULL;
12825 PyObject *__pyx_v_bytesvalue = 0;
12826 Py_ssize_t __pyx_v_i;
12827 PyObject *__pyx_r = NULL;
12828 __Pyx_RefNannyDeclarations
12829 PyObject *__pyx_t_1 = NULL;
12832 PyObject *__pyx_t_4 = NULL;
12833 PyObject *__pyx_t_5 = NULL;
12834 PyObject *__pyx_t_6 = NULL;
12836 PyObject *__pyx_t_8 = NULL;
12837 Py_ssize_t __pyx_t_9;
12838 PyObject *__pyx_t_10 = NULL;
12843 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
12852 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
12853 __Pyx_GOTREF(__pyx_t_1);
12854 __pyx_v_struct = __pyx_t_1;
12864 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
12865 __pyx_t_3 = (__pyx_t_2 != 0);
12875 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
12876 __Pyx_GOTREF(__pyx_t_1);
12877 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12878 __Pyx_GOTREF(__pyx_t_4);
12879 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
12880 __Pyx_GOTREF(__pyx_t_5);
12881 __Pyx_GIVEREF(__pyx_t_4);
12882 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
12884 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12885 __Pyx_GOTREF(__pyx_t_4);
12886 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
12887 __Pyx_GOTREF(__pyx_t_6);
12888 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12889 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12890 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12891 __Pyx_GOTREF(__pyx_t_4);
12892 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12893 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12894 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
12895 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12916 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
12917 __Pyx_GOTREF(__pyx_t_6);
12918 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
12919 __Pyx_GOTREF(__pyx_t_1);
12922 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
12923 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
12924 if (likely(__pyx_t_5)) {
12925 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
12926 __Pyx_INCREF(__pyx_t_5);
12927 __Pyx_INCREF(
function);
12928 __Pyx_DECREF_SET(__pyx_t_6,
function);
12932 #if CYTHON_FAST_PYCALL 12933 if (PyFunction_Check(__pyx_t_6)) {
12934 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12935 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12936 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12937 __Pyx_GOTREF(__pyx_t_4);
12938 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12941 #if CYTHON_FAST_PYCCALL 12942 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
12943 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12944 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12945 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12946 __Pyx_GOTREF(__pyx_t_4);
12947 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12951 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
12952 __Pyx_GOTREF(__pyx_t_8);
12954 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
12956 __Pyx_GIVEREF(__pyx_t_1);
12957 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
12958 __Pyx_INCREF(__pyx_v_value);
12959 __Pyx_GIVEREF(__pyx_v_value);
12960 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
12962 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12963 __Pyx_GOTREF(__pyx_t_4);
12964 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12966 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12967 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
12968 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12981 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
12982 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
12983 __PYX_ERR(1, 514, __pyx_L1_error)
12985 __Pyx_INCREF(__pyx_v_bytesvalue);
12986 __pyx_t_10 = __pyx_v_bytesvalue;
12987 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
12988 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
12989 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
12990 __pyx_t_11 = __pyx_t_14;
12991 __pyx_v_c = (__pyx_t_11[0]);
13000 __pyx_v_i = __pyx_t_9;
13009 __pyx_t_9 = (__pyx_t_9 + 1);
13018 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
13020 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13031 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13034 __Pyx_XDECREF(__pyx_t_1);
13035 __Pyx_XDECREF(__pyx_t_4);
13036 __Pyx_XDECREF(__pyx_t_5);
13037 __Pyx_XDECREF(__pyx_t_6);
13038 __Pyx_XDECREF(__pyx_t_8);
13039 __Pyx_XDECREF(__pyx_t_10);
13040 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
13043 __Pyx_XDECREF(__pyx_v_struct);
13044 __Pyx_XDECREF(__pyx_v_bytesvalue);
13045 __Pyx_XGIVEREF(__pyx_r);
13046 __Pyx_RefNannyFinishContext();
13059 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
13060 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
13062 __Pyx_RefNannyDeclarations
13063 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
13064 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
13067 __Pyx_RefNannyFinishContext();
13071 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
13073 __Pyx_RefNannyDeclarations
13076 PyObject *__pyx_t_3 = NULL;
13077 Py_ssize_t *__pyx_t_4;
13081 Py_ssize_t __pyx_t_8;
13082 if (__pyx_v_info == NULL) {
13083 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
13086 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
13087 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
13088 __Pyx_GIVEREF(__pyx_v_info->obj);
13097 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
13100 __pyx_t_1 = __pyx_t_2;
13101 goto __pyx_L4_bool_binop_done;
13103 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
13104 __pyx_t_1 = __pyx_t_2;
13105 __pyx_L4_bool_binop_done:;
13106 if (unlikely(__pyx_t_1)) {
13115 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
13116 __Pyx_GOTREF(__pyx_t_3);
13117 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13118 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13119 __PYX_ERR(1, 520, __pyx_L1_error)
13137 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
13147 __pyx_t_4 = __pyx_v_self->view.shape;
13148 __pyx_v_info->shape = __pyx_t_4;
13168 __pyx_v_info->shape = NULL;
13179 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
13189 __pyx_t_4 = __pyx_v_self->view.strides;
13190 __pyx_v_info->strides = __pyx_t_4;
13210 __pyx_v_info->strides = NULL;
13221 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
13231 __pyx_t_4 = __pyx_v_self->view.suboffsets;
13232 __pyx_v_info->suboffsets = __pyx_t_4;
13252 __pyx_v_info->suboffsets = NULL;
13263 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
13273 __pyx_t_5 = __pyx_v_self->view.format;
13274 __pyx_v_info->format = __pyx_t_5;
13294 __pyx_v_info->format = NULL;
13305 __pyx_t_6 = __pyx_v_self->view.buf;
13306 __pyx_v_info->buf = __pyx_t_6;
13315 __pyx_t_7 = __pyx_v_self->view.ndim;
13316 __pyx_v_info->ndim = __pyx_t_7;
13325 __pyx_t_8 = __pyx_v_self->view.itemsize;
13326 __pyx_v_info->itemsize = __pyx_t_8;
13335 __pyx_t_8 = __pyx_v_self->view.len;
13336 __pyx_v_info->len = __pyx_t_8;
13345 __pyx_t_1 = __pyx_v_self->view.readonly;
13346 __pyx_v_info->readonly = __pyx_t_1;
13355 __Pyx_INCREF(((PyObject *)__pyx_v_self));
13356 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13357 __Pyx_GOTREF(__pyx_v_info->obj);
13358 __Pyx_DECREF(__pyx_v_info->obj);
13359 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
13373 __Pyx_XDECREF(__pyx_t_3);
13374 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13376 if (__pyx_v_info->obj != NULL) {
13377 __Pyx_GOTREF(__pyx_v_info->obj);
13378 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
13382 if (__pyx_v_info->obj == Py_None) {
13383 __Pyx_GOTREF(__pyx_v_info->obj);
13384 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
13387 __Pyx_RefNannyFinishContext();
13400 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
13401 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
13402 PyObject *__pyx_r = 0;
13403 __Pyx_RefNannyDeclarations
13404 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13405 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13408 __Pyx_RefNannyFinishContext();
13412 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13413 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
13414 PyObject *__pyx_r = NULL;
13415 __Pyx_RefNannyDeclarations
13416 PyObject *__pyx_t_1 = NULL;
13418 __Pyx_RefNannySetupContext(
"__get__", 0);
13427 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
13428 __Pyx_GOTREF(__pyx_t_1);
13429 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
13430 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
13440 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
13449 __Pyx_XDECREF(__pyx_r);
13450 __Pyx_INCREF(((PyObject *)__pyx_v_result));
13451 __pyx_r = ((PyObject *)__pyx_v_result);
13464 __Pyx_XDECREF(__pyx_t_1);
13465 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13468 __Pyx_XDECREF((PyObject *)__pyx_v_result);
13469 __Pyx_XGIVEREF(__pyx_r);
13470 __Pyx_RefNannyFinishContext();
13483 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
13484 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
13485 PyObject *__pyx_r = 0;
13486 __Pyx_RefNannyDeclarations
13487 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13488 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13491 __Pyx_RefNannyFinishContext();
13495 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13496 PyObject *__pyx_r = NULL;
13497 __Pyx_RefNannyDeclarations
13498 __Pyx_RefNannySetupContext(
"__get__", 0);
13507 __Pyx_XDECREF(__pyx_r);
13508 __Pyx_INCREF(__pyx_v_self->obj);
13509 __pyx_r = __pyx_v_self->obj;
13522 __Pyx_XGIVEREF(__pyx_r);
13523 __Pyx_RefNannyFinishContext();
13536 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
13537 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
13538 PyObject *__pyx_r = 0;
13539 __Pyx_RefNannyDeclarations
13540 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13541 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13544 __Pyx_RefNannyFinishContext();
13548 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13549 Py_ssize_t __pyx_v_length;
13550 PyObject *__pyx_r = NULL;
13551 __Pyx_RefNannyDeclarations
13552 PyObject *__pyx_t_1 = NULL;
13553 Py_ssize_t *__pyx_t_2;
13554 Py_ssize_t *__pyx_t_3;
13555 Py_ssize_t *__pyx_t_4;
13556 PyObject *__pyx_t_5 = NULL;
13557 __Pyx_RefNannySetupContext(
"__get__", 0);
13566 __Pyx_XDECREF(__pyx_r);
13567 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
13568 __Pyx_GOTREF(__pyx_t_1);
13569 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13570 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
13571 __pyx_t_2 = __pyx_t_4;
13572 __pyx_v_length = (__pyx_t_2[0]);
13573 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
13574 __Pyx_GOTREF(__pyx_t_5);
13575 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
13576 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13578 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
13579 __Pyx_GOTREF(__pyx_t_5);
13580 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13581 __pyx_r = __pyx_t_5;
13595 __Pyx_XDECREF(__pyx_t_1);
13596 __Pyx_XDECREF(__pyx_t_5);
13597 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13600 __Pyx_XGIVEREF(__pyx_r);
13601 __Pyx_RefNannyFinishContext();
13614 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
13615 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
13616 PyObject *__pyx_r = 0;
13617 __Pyx_RefNannyDeclarations
13618 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13619 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13622 __Pyx_RefNannyFinishContext();
13626 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13627 Py_ssize_t __pyx_v_stride;
13628 PyObject *__pyx_r = NULL;
13629 __Pyx_RefNannyDeclarations
13631 PyObject *__pyx_t_2 = NULL;
13632 Py_ssize_t *__pyx_t_3;
13633 Py_ssize_t *__pyx_t_4;
13634 Py_ssize_t *__pyx_t_5;
13635 PyObject *__pyx_t_6 = NULL;
13636 __Pyx_RefNannySetupContext(
"__get__", 0);
13645 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
13646 if (unlikely(__pyx_t_1)) {
13655 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
13656 __Pyx_GOTREF(__pyx_t_2);
13657 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13658 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13659 __PYX_ERR(1, 570, __pyx_L1_error)
13677 __Pyx_XDECREF(__pyx_r);
13678 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
13679 __Pyx_GOTREF(__pyx_t_2);
13680 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
13681 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13682 __pyx_t_3 = __pyx_t_5;
13683 __pyx_v_stride = (__pyx_t_3[0]);
13684 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
13685 __Pyx_GOTREF(__pyx_t_6);
13686 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
13687 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13689 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
13690 __Pyx_GOTREF(__pyx_t_6);
13691 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13692 __pyx_r = __pyx_t_6;
13706 __Pyx_XDECREF(__pyx_t_2);
13707 __Pyx_XDECREF(__pyx_t_6);
13708 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13711 __Pyx_XGIVEREF(__pyx_r);
13712 __Pyx_RefNannyFinishContext();
13725 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
13726 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
13727 PyObject *__pyx_r = 0;
13728 __Pyx_RefNannyDeclarations
13729 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13730 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13733 __Pyx_RefNannyFinishContext();
13737 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13738 Py_ssize_t __pyx_v_suboffset;
13739 PyObject *__pyx_r = NULL;
13740 __Pyx_RefNannyDeclarations
13742 PyObject *__pyx_t_2 = NULL;
13743 PyObject *__pyx_t_3 = NULL;
13744 Py_ssize_t *__pyx_t_4;
13745 Py_ssize_t *__pyx_t_5;
13746 Py_ssize_t *__pyx_t_6;
13747 __Pyx_RefNannySetupContext(
"__get__", 0);
13756 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
13766 __Pyx_XDECREF(__pyx_r);
13767 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
13768 __Pyx_GOTREF(__pyx_t_2);
13769 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__24, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
13770 __Pyx_GOTREF(__pyx_t_3);
13771 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13772 __pyx_r = __pyx_t_3;
13792 __Pyx_XDECREF(__pyx_r);
13793 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
13794 __Pyx_GOTREF(__pyx_t_3);
13795 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
13796 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
13797 __pyx_t_4 = __pyx_t_6;
13798 __pyx_v_suboffset = (__pyx_t_4[0]);
13799 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
13800 __Pyx_GOTREF(__pyx_t_2);
13801 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
13802 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13804 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
13805 __Pyx_GOTREF(__pyx_t_2);
13806 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13807 __pyx_r = __pyx_t_2;
13821 __Pyx_XDECREF(__pyx_t_2);
13822 __Pyx_XDECREF(__pyx_t_3);
13823 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13826 __Pyx_XGIVEREF(__pyx_r);
13827 __Pyx_RefNannyFinishContext();
13840 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
13841 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
13842 PyObject *__pyx_r = 0;
13843 __Pyx_RefNannyDeclarations
13844 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13845 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13848 __Pyx_RefNannyFinishContext();
13852 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13853 PyObject *__pyx_r = NULL;
13854 __Pyx_RefNannyDeclarations
13855 PyObject *__pyx_t_1 = NULL;
13856 __Pyx_RefNannySetupContext(
"__get__", 0);
13865 __Pyx_XDECREF(__pyx_r);
13866 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
13867 __Pyx_GOTREF(__pyx_t_1);
13868 __pyx_r = __pyx_t_1;
13882 __Pyx_XDECREF(__pyx_t_1);
13883 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13886 __Pyx_XGIVEREF(__pyx_r);
13887 __Pyx_RefNannyFinishContext();
13900 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
13901 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
13902 PyObject *__pyx_r = 0;
13903 __Pyx_RefNannyDeclarations
13904 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13905 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13908 __Pyx_RefNannyFinishContext();
13912 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13913 PyObject *__pyx_r = NULL;
13914 __Pyx_RefNannyDeclarations
13915 PyObject *__pyx_t_1 = NULL;
13916 __Pyx_RefNannySetupContext(
"__get__", 0);
13925 __Pyx_XDECREF(__pyx_r);
13926 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
13927 __Pyx_GOTREF(__pyx_t_1);
13928 __pyx_r = __pyx_t_1;
13942 __Pyx_XDECREF(__pyx_t_1);
13943 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13946 __Pyx_XGIVEREF(__pyx_r);
13947 __Pyx_RefNannyFinishContext();
13960 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
13961 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
13962 PyObject *__pyx_r = 0;
13963 __Pyx_RefNannyDeclarations
13964 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13965 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13968 __Pyx_RefNannyFinishContext();
13972 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13973 PyObject *__pyx_r = NULL;
13974 __Pyx_RefNannyDeclarations
13975 PyObject *__pyx_t_1 = NULL;
13976 PyObject *__pyx_t_2 = NULL;
13977 PyObject *__pyx_t_3 = NULL;
13978 __Pyx_RefNannySetupContext(
"__get__", 0);
13987 __Pyx_XDECREF(__pyx_r);
13988 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
13989 __Pyx_GOTREF(__pyx_t_1);
13990 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
13991 __Pyx_GOTREF(__pyx_t_2);
13992 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
13993 __Pyx_GOTREF(__pyx_t_3);
13994 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13995 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13996 __pyx_r = __pyx_t_3;
14010 __Pyx_XDECREF(__pyx_t_1);
14011 __Pyx_XDECREF(__pyx_t_2);
14012 __Pyx_XDECREF(__pyx_t_3);
14013 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14016 __Pyx_XGIVEREF(__pyx_r);
14017 __Pyx_RefNannyFinishContext();
14030 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
14031 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
14032 PyObject *__pyx_r = 0;
14033 __Pyx_RefNannyDeclarations
14034 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
14035 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14038 __Pyx_RefNannyFinishContext();
14042 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
14043 PyObject *__pyx_v_result = NULL;
14044 PyObject *__pyx_v_length = NULL;
14045 PyObject *__pyx_r = NULL;
14046 __Pyx_RefNannyDeclarations
14049 Py_ssize_t *__pyx_t_3;
14050 Py_ssize_t *__pyx_t_4;
14051 Py_ssize_t *__pyx_t_5;
14052 PyObject *__pyx_t_6 = NULL;
14053 __Pyx_RefNannySetupContext(
"__get__", 0);
14062 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
14063 __pyx_t_2 = (__pyx_t_1 != 0);
14073 __Pyx_INCREF(__pyx_int_1);
14074 __pyx_v_result = __pyx_int_1;
14083 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
14084 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
14085 __pyx_t_3 = __pyx_t_5;
14086 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
14087 __Pyx_GOTREF(__pyx_t_6);
14088 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
14098 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
14099 __Pyx_GOTREF(__pyx_t_6);
14100 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
14111 __Pyx_INCREF(__pyx_v_result);
14112 __Pyx_GIVEREF(__pyx_v_result);
14113 __Pyx_GOTREF(__pyx_v_self->_size);
14114 __Pyx_DECREF(__pyx_v_self->_size);
14115 __pyx_v_self->_size = __pyx_v_result;
14133 __Pyx_XDECREF(__pyx_r);
14134 __Pyx_INCREF(__pyx_v_self->_size);
14135 __pyx_r = __pyx_v_self->_size;
14148 __Pyx_XDECREF(__pyx_t_6);
14149 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14152 __Pyx_XDECREF(__pyx_v_result);
14153 __Pyx_XDECREF(__pyx_v_length);
14154 __Pyx_XGIVEREF(__pyx_r);
14155 __Pyx_RefNannyFinishContext();
14168 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
14169 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
14170 Py_ssize_t __pyx_r;
14171 __Pyx_RefNannyDeclarations
14172 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
14173 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14176 __Pyx_RefNannyFinishContext();
14180 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
14181 Py_ssize_t __pyx_r;
14182 __Pyx_RefNannyDeclarations
14184 __Pyx_RefNannySetupContext(
"__len__", 0);
14193 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
14203 __pyx_r = (__pyx_v_self->view.shape[0]);
14235 __Pyx_RefNannyFinishContext();
14248 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
14249 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
14250 PyObject *__pyx_r = 0;
14251 __Pyx_RefNannyDeclarations
14252 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
14253 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14256 __Pyx_RefNannyFinishContext();
14260 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
14261 PyObject *__pyx_r = NULL;
14262 __Pyx_RefNannyDeclarations
14263 PyObject *__pyx_t_1 = NULL;
14264 PyObject *__pyx_t_2 = NULL;
14265 PyObject *__pyx_t_3 = NULL;
14266 __Pyx_RefNannySetupContext(
"__repr__", 0);
14275 __Pyx_XDECREF(__pyx_r);
14276 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
14277 __Pyx_GOTREF(__pyx_t_1);
14278 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
14279 __Pyx_GOTREF(__pyx_t_2);
14280 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14281 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
14282 __Pyx_GOTREF(__pyx_t_1);
14283 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14292 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
14293 __Pyx_GOTREF(__pyx_t_2);
14302 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
14303 __Pyx_GOTREF(__pyx_t_3);
14304 __Pyx_GIVEREF(__pyx_t_1);
14305 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
14306 __Pyx_GIVEREF(__pyx_t_2);
14307 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
14310 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
14311 __Pyx_GOTREF(__pyx_t_2);
14312 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14313 __pyx_r = __pyx_t_2;
14327 __Pyx_XDECREF(__pyx_t_1);
14328 __Pyx_XDECREF(__pyx_t_2);
14329 __Pyx_XDECREF(__pyx_t_3);
14330 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14333 __Pyx_XGIVEREF(__pyx_r);
14334 __Pyx_RefNannyFinishContext();
14347 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
14348 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
14349 PyObject *__pyx_r = 0;
14350 __Pyx_RefNannyDeclarations
14351 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
14352 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14355 __Pyx_RefNannyFinishContext();
14359 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
14360 PyObject *__pyx_r = NULL;
14361 __Pyx_RefNannyDeclarations
14362 PyObject *__pyx_t_1 = NULL;
14363 PyObject *__pyx_t_2 = NULL;
14364 __Pyx_RefNannySetupContext(
"__str__", 0);
14373 __Pyx_XDECREF(__pyx_r);
14374 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
14375 __Pyx_GOTREF(__pyx_t_1);
14376 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
14377 __Pyx_GOTREF(__pyx_t_2);
14378 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14379 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
14380 __Pyx_GOTREF(__pyx_t_1);
14381 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14382 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
14383 __Pyx_GOTREF(__pyx_t_2);
14384 __Pyx_GIVEREF(__pyx_t_1);
14385 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
14387 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
14388 __Pyx_GOTREF(__pyx_t_1);
14389 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14390 __pyx_r = __pyx_t_1;
14404 __Pyx_XDECREF(__pyx_t_1);
14405 __Pyx_XDECREF(__pyx_t_2);
14406 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14409 __Pyx_XGIVEREF(__pyx_r);
14410 __Pyx_RefNannyFinishContext();
14423 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14424 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14425 PyObject *__pyx_r = 0;
14426 __Pyx_RefNannyDeclarations
14427 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
14428 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14431 __Pyx_RefNannyFinishContext();
14435 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
14436 __Pyx_memviewslice *__pyx_v_mslice;
14437 __Pyx_memviewslice __pyx_v_tmp;
14438 PyObject *__pyx_r = NULL;
14439 __Pyx_RefNannyDeclarations
14440 __Pyx_memviewslice *__pyx_t_1;
14441 PyObject *__pyx_t_2 = NULL;
14442 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
14451 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 622, __pyx_L1_error)
14452 __pyx_v_mslice = __pyx_t_1;
14461 __Pyx_XDECREF(__pyx_r);
14462 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
14463 __Pyx_GOTREF(__pyx_t_2);
14464 __pyx_r = __pyx_t_2;
14478 __Pyx_XDECREF(__pyx_t_2);
14479 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
14482 __Pyx_XGIVEREF(__pyx_r);
14483 __Pyx_RefNannyFinishContext();
14496 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14497 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14498 PyObject *__pyx_r = 0;
14499 __Pyx_RefNannyDeclarations
14500 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
14501 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14504 __Pyx_RefNannyFinishContext();
14508 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
14509 __Pyx_memviewslice *__pyx_v_mslice;
14510 __Pyx_memviewslice __pyx_v_tmp;
14511 PyObject *__pyx_r = NULL;
14512 __Pyx_RefNannyDeclarations
14513 __Pyx_memviewslice *__pyx_t_1;
14514 PyObject *__pyx_t_2 = NULL;
14515 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
14524 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
14525 __pyx_v_mslice = __pyx_t_1;
14534 __Pyx_XDECREF(__pyx_r);
14535 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
14536 __Pyx_GOTREF(__pyx_t_2);
14537 __pyx_r = __pyx_t_2;
14551 __Pyx_XDECREF(__pyx_t_2);
14552 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
14555 __Pyx_XGIVEREF(__pyx_r);
14556 __Pyx_RefNannyFinishContext();
14569 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14570 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14571 PyObject *__pyx_r = 0;
14572 __Pyx_RefNannyDeclarations
14573 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
14574 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14577 __Pyx_RefNannyFinishContext();
14581 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
14582 __Pyx_memviewslice __pyx_v_mslice;
14584 PyObject *__pyx_r = NULL;
14585 __Pyx_RefNannyDeclarations
14586 __Pyx_memviewslice __pyx_t_1;
14587 PyObject *__pyx_t_2 = NULL;
14588 __Pyx_RefNannySetupContext(
"copy", 0);
14597 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
14606 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
14615 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
14616 __pyx_v_mslice = __pyx_t_1;
14625 __Pyx_XDECREF(__pyx_r);
14626 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
14627 __Pyx_GOTREF(__pyx_t_2);
14628 __pyx_r = __pyx_t_2;
14642 __Pyx_XDECREF(__pyx_t_2);
14643 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14646 __Pyx_XGIVEREF(__pyx_r);
14647 __Pyx_RefNannyFinishContext();
14660 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14661 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14662 PyObject *__pyx_r = 0;
14663 __Pyx_RefNannyDeclarations
14664 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
14665 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14668 __Pyx_RefNannyFinishContext();
14672 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
14673 __Pyx_memviewslice __pyx_v_src;
14674 __Pyx_memviewslice __pyx_v_dst;
14676 PyObject *__pyx_r = NULL;
14677 __Pyx_RefNannyDeclarations
14678 __Pyx_memviewslice __pyx_t_1;
14679 PyObject *__pyx_t_2 = NULL;
14680 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
14689 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
14698 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
14707 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
14708 __pyx_v_dst = __pyx_t_1;
14717 __Pyx_XDECREF(__pyx_r);
14718 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
14719 __Pyx_GOTREF(__pyx_t_2);
14720 __pyx_r = __pyx_t_2;
14734 __Pyx_XDECREF(__pyx_t_2);
14735 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
14738 __Pyx_XGIVEREF(__pyx_r);
14739 __Pyx_RefNannyFinishContext();
14750 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14751 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14752 PyObject *__pyx_r = 0;
14753 __Pyx_RefNannyDeclarations
14754 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
14755 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14758 __Pyx_RefNannyFinishContext();
14762 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
14763 PyObject *__pyx_r = NULL;
14764 __Pyx_RefNannyDeclarations
14765 PyObject *__pyx_t_1 = NULL;
14766 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
14774 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
14775 __Pyx_GOTREF(__pyx_t_1);
14776 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14777 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14778 __PYX_ERR(1, 2, __pyx_L1_error)
14788 __Pyx_XDECREF(__pyx_t_1);
14789 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14791 __Pyx_XGIVEREF(__pyx_r);
14792 __Pyx_RefNannyFinishContext();
14804 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
14805 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14806 PyObject *__pyx_r = 0;
14807 __Pyx_RefNannyDeclarations
14808 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
14809 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14812 __Pyx_RefNannyFinishContext();
14816 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14817 PyObject *__pyx_r = NULL;
14818 __Pyx_RefNannyDeclarations
14819 PyObject *__pyx_t_1 = NULL;
14820 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
14827 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
14828 __Pyx_GOTREF(__pyx_t_1);
14829 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14830 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14831 __PYX_ERR(1, 4, __pyx_L1_error)
14842 __Pyx_XDECREF(__pyx_t_1);
14843 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14845 __Pyx_XGIVEREF(__pyx_r);
14846 __Pyx_RefNannyFinishContext();
14858 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
14859 struct __pyx_memoryview_obj *__pyx_v_result = 0;
14860 PyObject *__pyx_r = NULL;
14861 __Pyx_RefNannyDeclarations
14862 PyObject *__pyx_t_1 = NULL;
14863 PyObject *__pyx_t_2 = NULL;
14864 PyObject *__pyx_t_3 = NULL;
14865 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
14874 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
14875 __Pyx_GOTREF(__pyx_t_1);
14876 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
14877 __Pyx_GOTREF(__pyx_t_2);
14878 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
14879 __Pyx_GOTREF(__pyx_t_3);
14880 __Pyx_INCREF(__pyx_v_o);
14881 __Pyx_GIVEREF(__pyx_v_o);
14882 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
14883 __Pyx_GIVEREF(__pyx_t_1);
14884 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
14885 __Pyx_GIVEREF(__pyx_t_2);
14886 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14889 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
14890 __Pyx_GOTREF(__pyx_t_2);
14891 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14892 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
14902 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
14911 __Pyx_XDECREF(__pyx_r);
14912 __Pyx_INCREF(((PyObject *)__pyx_v_result));
14913 __pyx_r = ((PyObject *)__pyx_v_result);
14926 __Pyx_XDECREF(__pyx_t_1);
14927 __Pyx_XDECREF(__pyx_t_2);
14928 __Pyx_XDECREF(__pyx_t_3);
14929 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
14932 __Pyx_XDECREF((PyObject *)__pyx_v_result);
14933 __Pyx_XGIVEREF(__pyx_r);
14934 __Pyx_RefNannyFinishContext();
14946 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
14948 __Pyx_RefNannyDeclarations
14950 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
14959 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
14960 __pyx_r = __pyx_t_1;
14973 __Pyx_RefNannyFinishContext();
14985 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
14986 PyObject *__pyx_v_tup = NULL;
14987 PyObject *__pyx_v_result = NULL;
14988 int __pyx_v_have_slices;
14989 int __pyx_v_seen_ellipsis;
14990 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
14991 PyObject *__pyx_v_item = NULL;
14992 Py_ssize_t __pyx_v_nslices;
14993 PyObject *__pyx_r = NULL;
14994 __Pyx_RefNannyDeclarations
14997 PyObject *__pyx_t_3 = NULL;
14998 PyObject *__pyx_t_4 = NULL;
14999 Py_ssize_t __pyx_t_5;
15000 PyObject *(*__pyx_t_6)(PyObject *);
15001 PyObject *__pyx_t_7 = NULL;
15002 Py_ssize_t __pyx_t_8;
15005 PyObject *__pyx_t_11 = NULL;
15006 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
15015 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
15016 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
15026 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
15027 __Pyx_GOTREF(__pyx_t_3);
15028 __Pyx_INCREF(__pyx_v_index);
15029 __Pyx_GIVEREF(__pyx_v_index);
15030 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
15031 __pyx_v_tup = __pyx_t_3;
15052 __Pyx_INCREF(__pyx_v_index);
15053 __pyx_v_tup = __pyx_v_index;
15064 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
15065 __Pyx_GOTREF(__pyx_t_3);
15066 __pyx_v_result = ((PyObject*)__pyx_t_3);
15076 __pyx_v_have_slices = 0;
15085 __pyx_v_seen_ellipsis = 0;
15094 __Pyx_INCREF(__pyx_int_0);
15095 __pyx_t_3 = __pyx_int_0;
15096 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
15097 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
15100 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
15101 __Pyx_GOTREF(__pyx_t_4);
15102 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
15105 if (likely(!__pyx_t_6)) {
15106 if (likely(PyList_CheckExact(__pyx_t_4))) {
15107 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
15108 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 15109 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
15111 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
15112 __Pyx_GOTREF(__pyx_t_7);
15115 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
15116 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 15117 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
15119 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
15120 __Pyx_GOTREF(__pyx_t_7);
15124 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
15125 if (unlikely(!__pyx_t_7)) {
15126 PyObject* exc_type = PyErr_Occurred();
15128 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15129 else __PYX_ERR(1, 679, __pyx_L1_error)
15133 __Pyx_GOTREF(__pyx_t_7);
15135 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
15137 __Pyx_INCREF(__pyx_t_3);
15138 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
15139 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
15140 __Pyx_GOTREF(__pyx_t_7);
15141 __Pyx_DECREF(__pyx_t_3);
15142 __pyx_t_3 = __pyx_t_7;
15152 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
15153 __pyx_t_1 = (__pyx_t_2 != 0);
15163 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
15173 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
15174 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
15175 __Pyx_GOTREF(__pyx_t_7);
15176 { Py_ssize_t __pyx_temp;
15177 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
15178 __Pyx_INCREF(__pyx_slice__27);
15179 __Pyx_GIVEREF(__pyx_slice__27);
15180 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__27);
15183 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
15184 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15193 __pyx_v_seen_ellipsis = 1;
15213 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__27);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
15224 __pyx_v_have_slices = 1;
15244 __pyx_t_2 = PySlice_Check(__pyx_v_item);
15245 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
15248 __pyx_t_1 = __pyx_t_10;
15249 goto __pyx_L9_bool_binop_done;
15251 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
15252 __pyx_t_1 = __pyx_t_10;
15253 __pyx_L9_bool_binop_done:;
15254 if (unlikely(__pyx_t_1)) {
15263 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
15264 __Pyx_GOTREF(__pyx_t_7);
15265 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
15266 __Pyx_GOTREF(__pyx_t_11);
15267 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15268 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
15269 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15270 __PYX_ERR(1, 689, __pyx_L1_error)
15288 __pyx_t_10 = (__pyx_v_have_slices != 0);
15291 __pyx_t_1 = __pyx_t_10;
15292 goto __pyx_L11_bool_binop_done;
15294 __pyx_t_10 = PySlice_Check(__pyx_v_item);
15295 __pyx_t_2 = (__pyx_t_10 != 0);
15296 __pyx_t_1 = __pyx_t_2;
15297 __pyx_L11_bool_binop_done:;
15298 __pyx_v_have_slices = __pyx_t_1;
15307 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
15319 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15320 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15329 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
15330 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
15339 __pyx_t_1 = (__pyx_v_nslices != 0);
15349 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
15350 __Pyx_GOTREF(__pyx_t_3);
15351 { Py_ssize_t __pyx_temp;
15352 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
15353 __Pyx_INCREF(__pyx_slice__27);
15354 __Pyx_GIVEREF(__pyx_slice__27);
15355 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__27);
15358 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
15359 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15377 __Pyx_XDECREF(__pyx_r);
15378 if (!__pyx_v_have_slices) {
15380 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
15381 __Pyx_GOTREF(__pyx_t_4);
15382 __pyx_t_3 = __pyx_t_4;
15384 goto __pyx_L14_bool_binop_done;
15386 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
15387 __Pyx_GOTREF(__pyx_t_4);
15388 __pyx_t_3 = __pyx_t_4;
15390 __pyx_L14_bool_binop_done:;
15391 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
15392 __Pyx_GOTREF(__pyx_t_4);
15393 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
15394 __Pyx_GOTREF(__pyx_t_11);
15395 __Pyx_GIVEREF(__pyx_t_3);
15396 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
15397 __Pyx_GIVEREF(__pyx_t_4);
15398 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
15401 __pyx_r = ((PyObject*)__pyx_t_11);
15415 __Pyx_XDECREF(__pyx_t_3);
15416 __Pyx_XDECREF(__pyx_t_4);
15417 __Pyx_XDECREF(__pyx_t_7);
15418 __Pyx_XDECREF(__pyx_t_11);
15419 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
15422 __Pyx_XDECREF(__pyx_v_tup);
15423 __Pyx_XDECREF(__pyx_v_result);
15424 __Pyx_XDECREF(__pyx_v_idx);
15425 __Pyx_XDECREF(__pyx_v_item);
15426 __Pyx_XGIVEREF(__pyx_r);
15427 __Pyx_RefNannyFinishContext();
15439 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
15440 Py_ssize_t __pyx_v_suboffset;
15441 PyObject *__pyx_r = NULL;
15442 __Pyx_RefNannyDeclarations
15443 Py_ssize_t *__pyx_t_1;
15444 Py_ssize_t *__pyx_t_2;
15445 Py_ssize_t *__pyx_t_3;
15447 PyObject *__pyx_t_5 = NULL;
15448 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
15457 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
15458 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
15459 __pyx_t_1 = __pyx_t_3;
15460 __pyx_v_suboffset = (__pyx_t_1[0]);
15469 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
15470 if (unlikely(__pyx_t_4)) {
15479 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
15480 __Pyx_GOTREF(__pyx_t_5);
15481 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
15482 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15483 __PYX_ERR(1, 703, __pyx_L1_error)
15504 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15507 __Pyx_XDECREF(__pyx_t_5);
15508 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
15511 __Pyx_XGIVEREF(__pyx_r);
15512 __Pyx_RefNannyFinishContext();
15524 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
15525 int __pyx_v_new_ndim;
15526 int __pyx_v_suboffset_dim;
15528 __Pyx_memviewslice __pyx_v_src;
15529 __Pyx_memviewslice __pyx_v_dst;
15530 __Pyx_memviewslice *__pyx_v_p_src;
15531 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
15532 __Pyx_memviewslice *__pyx_v_p_dst;
15533 int *__pyx_v_p_suboffset_dim;
15534 Py_ssize_t __pyx_v_start;
15535 Py_ssize_t __pyx_v_stop;
15536 Py_ssize_t __pyx_v_step;
15537 int __pyx_v_have_start;
15538 int __pyx_v_have_stop;
15539 int __pyx_v_have_step;
15540 PyObject *__pyx_v_index = NULL;
15541 struct __pyx_memoryview_obj *__pyx_r = NULL;
15542 __Pyx_RefNannyDeclarations
15545 PyObject *__pyx_t_3 = NULL;
15546 struct __pyx_memoryview_obj *__pyx_t_4;
15549 Py_ssize_t __pyx_t_7;
15550 PyObject *(*__pyx_t_8)(PyObject *);
15551 PyObject *__pyx_t_9 = NULL;
15552 Py_ssize_t __pyx_t_10;
15554 Py_ssize_t __pyx_t_12;
15555 __Pyx_RefNannySetupContext(
"memview_slice", 0);
15564 __pyx_v_new_ndim = 0;
15565 __pyx_v_suboffset_dim = -1;
15574 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
15583 #ifndef CYTHON_WITHOUT_ASSERTIONS 15584 if (unlikely(!Py_OptimizeFlag)) {
15585 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
15586 PyErr_SetNone(PyExc_AssertionError);
15587 __PYX_ERR(1, 722, __pyx_L1_error)
15599 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15600 __pyx_t_2 = (__pyx_t_1 != 0);
15610 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
15611 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15612 __Pyx_INCREF(__pyx_t_3);
15613 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15623 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
15643 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
15652 __pyx_v_p_src = (&__pyx_v_src);
15663 __pyx_t_4 = __pyx_v_p_src->memview;
15664 __pyx_v_dst.memview = __pyx_t_4;
15673 __pyx_t_5 = __pyx_v_p_src->data;
15674 __pyx_v_dst.data = __pyx_t_5;
15683 __pyx_v_p_dst = (&__pyx_v_dst);
15692 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
15702 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
15703 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
15706 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
15707 __Pyx_GOTREF(__pyx_t_3);
15708 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
15711 if (likely(!__pyx_t_8)) {
15712 if (likely(PyList_CheckExact(__pyx_t_3))) {
15713 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
15714 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 15715 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
15717 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
15718 __Pyx_GOTREF(__pyx_t_9);
15721 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
15722 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 15723 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
15725 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
15726 __Pyx_GOTREF(__pyx_t_9);
15730 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
15731 if (unlikely(!__pyx_t_9)) {
15732 PyObject* exc_type = PyErr_Occurred();
15734 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15735 else __PYX_ERR(1, 746, __pyx_L1_error)
15739 __Pyx_GOTREF(__pyx_t_9);
15741 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
15743 __pyx_v_dim = __pyx_t_6;
15744 __pyx_t_6 = (__pyx_t_6 + 1);
15753 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
15763 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
15772 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
15791 __pyx_t_2 = (__pyx_v_index == Py_None);
15792 __pyx_t_1 = (__pyx_t_2 != 0);
15802 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
15811 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
15820 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1
L;
15829 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15849 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
15850 __Pyx_GOTREF(__pyx_t_9);
15851 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
15853 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15855 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
15856 __pyx_t_10 = __pyx_t_12;
15857 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15858 goto __pyx_L7_bool_binop_done;
15861 __pyx_L7_bool_binop_done:;
15862 __pyx_v_start = __pyx_t_10;
15871 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
15872 __Pyx_GOTREF(__pyx_t_9);
15873 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
15875 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15877 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
15878 __pyx_t_10 = __pyx_t_12;
15879 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15880 goto __pyx_L9_bool_binop_done;
15883 __pyx_L9_bool_binop_done:;
15884 __pyx_v_stop = __pyx_t_10;
15893 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
15894 __Pyx_GOTREF(__pyx_t_9);
15895 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
15897 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15899 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
15900 __pyx_t_10 = __pyx_t_12;
15901 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15902 goto __pyx_L11_bool_binop_done;
15905 __pyx_L11_bool_binop_done:;
15906 __pyx_v_step = __pyx_t_10;
15915 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
15916 __Pyx_GOTREF(__pyx_t_9);
15917 __pyx_t_1 = (__pyx_t_9 != Py_None);
15918 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15919 __pyx_v_have_start = __pyx_t_1;
15928 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
15929 __Pyx_GOTREF(__pyx_t_9);
15930 __pyx_t_1 = (__pyx_t_9 != Py_None);
15931 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15932 __pyx_v_have_stop = __pyx_t_1;
15941 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
15942 __Pyx_GOTREF(__pyx_t_9);
15943 __pyx_t_1 = (__pyx_t_9 != Py_None);
15944 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15945 __pyx_v_have_step = __pyx_t_1;
15954 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
15963 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15975 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15984 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15985 __pyx_t_2 = (__pyx_t_1 != 0);
15995 __Pyx_XDECREF(((PyObject *)__pyx_r));
16004 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
16013 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
16022 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
16023 __Pyx_GOTREF(__pyx_t_3);
16024 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
16025 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
16046 __Pyx_XDECREF(((PyObject *)__pyx_r));
16055 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
16056 __Pyx_GOTREF(__pyx_t_3);
16065 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
16066 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
16081 __Pyx_XDECREF(__pyx_t_3);
16082 __Pyx_XDECREF(__pyx_t_9);
16083 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16086 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
16087 __Pyx_XDECREF(__pyx_v_index);
16088 __Pyx_XGIVEREF((PyObject *)__pyx_r);
16089 __Pyx_RefNannyFinishContext();
16101 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
16102 Py_ssize_t __pyx_v_new_shape;
16103 int __pyx_v_negative_step;
16116 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
16126 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
16136 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
16154 __pyx_t_1 = (0 <= __pyx_v_start);
16156 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
16158 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
16168 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
16197 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
16200 __pyx_t_2 = __pyx_t_1;
16201 goto __pyx_L6_bool_binop_done;
16203 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
16204 __pyx_t_2 = __pyx_t_1;
16205 __pyx_L6_bool_binop_done:;
16206 __pyx_v_negative_step = __pyx_t_2;
16215 __pyx_t_1 = (__pyx_v_have_step != 0);
16218 __pyx_t_2 = __pyx_t_1;
16219 goto __pyx_L9_bool_binop_done;
16221 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
16222 __pyx_t_2 = __pyx_t_1;
16223 __pyx_L9_bool_binop_done:;
16233 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
16251 __pyx_t_2 = (__pyx_v_have_start != 0);
16261 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
16271 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
16280 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
16318 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
16328 __pyx_t_2 = (__pyx_v_negative_step != 0);
16338 __pyx_v_start = (__pyx_v_shape - 1);
16358 __pyx_v_start = __pyx_v_shape;
16390 __pyx_t_2 = (__pyx_v_negative_step != 0);
16400 __pyx_v_start = (__pyx_v_shape - 1);
16433 __pyx_t_2 = (__pyx_v_have_stop != 0);
16443 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
16453 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
16462 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
16500 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
16510 __pyx_v_stop = __pyx_v_shape;
16540 __pyx_t_2 = (__pyx_v_negative_step != 0);
16550 __pyx_v_stop = -1
L;
16570 __pyx_v_stop = __pyx_v_shape;
16583 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
16611 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
16620 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
16630 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
16648 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
16658 __pyx_v_new_shape = 0;
16676 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
16685 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
16694 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
16705 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
16715 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
16735 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
16736 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
16747 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16757 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
16767 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
16777 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
16805 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
16827 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
16862 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16864 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16866 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16882 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
16883 Py_ssize_t __pyx_v_shape;
16884 Py_ssize_t __pyx_v_stride;
16885 Py_ssize_t __pyx_v_suboffset;
16886 Py_ssize_t __pyx_v_itemsize;
16887 char *__pyx_v_resultp;
16889 __Pyx_RefNannyDeclarations
16890 Py_ssize_t __pyx_t_1;
16892 PyObject *__pyx_t_3 = NULL;
16893 PyObject *__pyx_t_4 = NULL;
16894 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
16903 __pyx_v_suboffset = -1
L;
16912 __pyx_t_1 = __pyx_v_view->itemsize;
16913 __pyx_v_itemsize = __pyx_t_1;
16922 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
16932 if (unlikely(__pyx_v_itemsize == 0)) {
16933 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
16934 __PYX_ERR(1, 917, __pyx_L1_error)
16936 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
16937 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
16938 __PYX_ERR(1, 917, __pyx_L1_error)
16940 __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
16949 __pyx_v_stride = __pyx_v_itemsize;
16969 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
16978 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
16987 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
16997 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
17017 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
17027 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
17036 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
17037 if (unlikely(__pyx_t_2)) {
17046 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
17047 __Pyx_GOTREF(__pyx_t_3);
17048 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
17049 __Pyx_GOTREF(__pyx_t_4);
17050 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17051 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
17052 __Pyx_GOTREF(__pyx_t_3);
17053 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17054 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17055 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17056 __PYX_ERR(1, 928, __pyx_L1_error)
17083 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
17084 if (unlikely(__pyx_t_2)) {
17093 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
17094 __Pyx_GOTREF(__pyx_t_3);
17095 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
17096 __Pyx_GOTREF(__pyx_t_4);
17097 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17098 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
17099 __Pyx_GOTREF(__pyx_t_3);
17100 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17101 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17102 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17103 __PYX_ERR(1, 931, __pyx_L1_error)
17121 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
17130 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
17140 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
17158 __pyx_r = __pyx_v_resultp;
17171 __Pyx_XDECREF(__pyx_t_3);
17172 __Pyx_XDECREF(__pyx_t_4);
17173 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
17176 __Pyx_RefNannyFinishContext();
17188 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
17190 Py_ssize_t *__pyx_v_shape;
17191 Py_ssize_t *__pyx_v_strides;
17196 Py_ssize_t *__pyx_t_2;
17199 Py_ssize_t __pyx_t_5;
17200 Py_ssize_t __pyx_t_6;
17212 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
17213 __pyx_v_ndim = __pyx_t_1;
17222 __pyx_t_2 = __pyx_v_memslice->shape;
17223 __pyx_v_shape = __pyx_t_2;
17232 __pyx_t_2 = __pyx_v_memslice->strides;
17233 __pyx_v_strides = __pyx_t_2;
17242 __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
17243 __pyx_t_4 = __pyx_t_3;
17244 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
17245 __pyx_v_i = __pyx_t_1;
17254 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
17263 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
17264 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
17265 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
17266 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
17275 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
17276 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
17277 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
17278 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
17287 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
17290 __pyx_t_7 = __pyx_t_8;
17291 goto __pyx_L6_bool_binop_done;
17293 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
17294 __pyx_t_7 = __pyx_t_8;
17295 __pyx_L6_bool_binop_done:;
17305 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
17339 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17341 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17343 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17360 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
17361 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
17362 __Pyx_RefNannyDeclarations
17363 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
17364 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17367 __Pyx_RefNannyFinishContext();
17370 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17371 __Pyx_RefNannyDeclarations
17372 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
17381 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
17392 __Pyx_RefNannyFinishContext();
17403 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
17404 PyObject *__pyx_r = NULL;
17405 __Pyx_RefNannyDeclarations
17407 PyObject *__pyx_t_2 = NULL;
17408 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
17417 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
17427 __Pyx_XDECREF(__pyx_r);
17428 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
17429 __Pyx_GOTREF(__pyx_t_2);
17430 __pyx_r = __pyx_t_2;
17451 __Pyx_XDECREF(__pyx_r);
17452 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
17453 __Pyx_GOTREF(__pyx_t_2);
17454 __pyx_r = __pyx_t_2;
17469 __Pyx_XDECREF(__pyx_t_2);
17470 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
17473 __Pyx_XGIVEREF(__pyx_r);
17474 __Pyx_RefNannyFinishContext();
17486 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
17487 PyObject *__pyx_r = NULL;
17488 __Pyx_RefNannyDeclarations
17491 PyObject *__pyx_t_3 = NULL;
17492 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
17501 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
17511 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
17531 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
17532 __Pyx_GOTREF(__pyx_t_3);
17533 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17546 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17549 __Pyx_XDECREF(__pyx_t_3);
17550 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
17553 __Pyx_XGIVEREF(__pyx_r);
17554 __Pyx_RefNannyFinishContext();
17567 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
17568 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
17569 PyObject *__pyx_r = 0;
17570 __Pyx_RefNannyDeclarations
17571 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
17572 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17575 __Pyx_RefNannyFinishContext();
17579 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17580 PyObject *__pyx_r = NULL;
17581 __Pyx_RefNannyDeclarations
17582 __Pyx_RefNannySetupContext(
"__get__", 0);
17591 __Pyx_XDECREF(__pyx_r);
17592 __Pyx_INCREF(__pyx_v_self->from_object);
17593 __pyx_r = __pyx_v_self->from_object;
17606 __Pyx_XGIVEREF(__pyx_r);
17607 __Pyx_RefNannyFinishContext();
17618 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
17619 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17620 PyObject *__pyx_r = 0;
17621 __Pyx_RefNannyDeclarations
17622 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
17623 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17626 __Pyx_RefNannyFinishContext();
17630 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17631 PyObject *__pyx_r = NULL;
17632 __Pyx_RefNannyDeclarations
17633 PyObject *__pyx_t_1 = NULL;
17634 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
17642 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
17643 __Pyx_GOTREF(__pyx_t_1);
17644 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17645 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17646 __PYX_ERR(1, 2, __pyx_L1_error)
17656 __Pyx_XDECREF(__pyx_t_1);
17657 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17659 __Pyx_XGIVEREF(__pyx_r);
17660 __Pyx_RefNannyFinishContext();
17672 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
17673 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
17674 PyObject *__pyx_r = 0;
17675 __Pyx_RefNannyDeclarations
17676 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
17677 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
17680 __Pyx_RefNannyFinishContext();
17684 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
17685 PyObject *__pyx_r = NULL;
17686 __Pyx_RefNannyDeclarations
17687 PyObject *__pyx_t_1 = NULL;
17688 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
17695 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
17696 __Pyx_GOTREF(__pyx_t_1);
17697 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17698 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17699 __PYX_ERR(1, 4, __pyx_L1_error)
17710 __Pyx_XDECREF(__pyx_t_1);
17711 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17713 __Pyx_XGIVEREF(__pyx_r);
17714 __Pyx_RefNannyFinishContext();
17726 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
17727 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
17728 Py_ssize_t __pyx_v_suboffset;
17729 PyObject *__pyx_v_length = NULL;
17730 PyObject *__pyx_r = NULL;
17731 __Pyx_RefNannyDeclarations
17733 PyObject *__pyx_t_2 = NULL;
17734 PyObject *__pyx_t_3 = NULL;
17735 __Pyx_TypeInfo *__pyx_t_4;
17736 Py_buffer __pyx_t_5;
17737 Py_ssize_t *__pyx_t_6;
17738 Py_ssize_t *__pyx_t_7;
17739 Py_ssize_t *__pyx_t_8;
17740 Py_ssize_t __pyx_t_9;
17741 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
17750 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
17760 __Pyx_XDECREF(__pyx_r);
17761 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17780 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
17781 __Pyx_GOTREF(__pyx_t_2);
17782 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
17783 __Pyx_GOTREF(__pyx_t_3);
17784 __Pyx_INCREF(Py_None);
17785 __Pyx_GIVEREF(Py_None);
17786 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
17787 __Pyx_INCREF(__pyx_int_0);
17788 __Pyx_GIVEREF(__pyx_int_0);
17789 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
17790 __Pyx_GIVEREF(__pyx_t_2);
17791 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
17793 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
17794 __Pyx_GOTREF(__pyx_t_2);
17795 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17796 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
17806 __pyx_v_result->from_slice = __pyx_v_memviewslice;
17815 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
17824 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
17825 __Pyx_GOTREF(__pyx_t_2);
17826 __Pyx_GIVEREF(__pyx_t_2);
17827 __Pyx_GOTREF(__pyx_v_result->from_object);
17828 __Pyx_DECREF(__pyx_v_result->from_object);
17829 __pyx_v_result->from_object = __pyx_t_2;
17839 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
17840 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
17849 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
17850 __pyx_v_result->__pyx_base.view = __pyx_t_5;
17859 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
17868 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
17877 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
17886 Py_INCREF(Py_None);
17895 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
17905 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
17925 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
17936 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
17945 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
17954 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
17963 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
17964 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17965 __pyx_t_6 = __pyx_t_8;
17966 __pyx_v_suboffset = (__pyx_t_6[0]);
17975 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
17985 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
17994 goto __pyx_L6_break;
18014 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
18015 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
18024 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
18025 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
18026 __pyx_t_6 = __pyx_t_8;
18027 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
18028 __Pyx_GOTREF(__pyx_t_2);
18029 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
18039 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
18040 __Pyx_GOTREF(__pyx_t_2);
18041 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
18042 __Pyx_GOTREF(__pyx_t_3);
18043 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18044 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
18045 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18046 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
18056 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
18065 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
18074 __Pyx_XDECREF(__pyx_r);
18075 __Pyx_INCREF(((PyObject *)__pyx_v_result));
18076 __pyx_r = ((PyObject *)__pyx_v_result);
18089 __Pyx_XDECREF(__pyx_t_2);
18090 __Pyx_XDECREF(__pyx_t_3);
18091 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18094 __Pyx_XDECREF((PyObject *)__pyx_v_result);
18095 __Pyx_XDECREF(__pyx_v_length);
18096 __Pyx_XGIVEREF(__pyx_r);
18097 __Pyx_RefNannyFinishContext();
18109 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
18110 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
18111 __Pyx_memviewslice *__pyx_r;
18112 __Pyx_RefNannyDeclarations
18115 PyObject *__pyx_t_3 = NULL;
18116 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
18125 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18126 __pyx_t_2 = (__pyx_t_1 != 0);
18136 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
18137 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
18138 __Pyx_INCREF(__pyx_t_3);
18139 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
18149 __pyx_r = (&__pyx_v_obj->from_slice);
18169 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
18178 __pyx_r = __pyx_v_mslice;
18192 __Pyx_XDECREF(__pyx_t_3);
18193 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
18196 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
18197 __Pyx_RefNannyFinishContext();
18209 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
18211 Py_ssize_t *__pyx_v_shape;
18212 Py_ssize_t *__pyx_v_strides;
18213 Py_ssize_t *__pyx_v_suboffsets;
18214 __Pyx_RefNannyDeclarations
18215 Py_ssize_t *__pyx_t_1;
18219 Py_ssize_t __pyx_t_5;
18220 __Pyx_RefNannySetupContext(
"slice_copy", 0);
18229 __pyx_t_1 = __pyx_v_memview->view.shape;
18230 __pyx_v_shape = __pyx_t_1;
18239 __pyx_t_1 = __pyx_v_memview->view.strides;
18240 __pyx_v_strides = __pyx_t_1;
18249 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
18250 __pyx_v_suboffsets = __pyx_t_1;
18259 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
18268 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
18277 __pyx_t_2 = __pyx_v_memview->view.ndim;
18278 __pyx_t_3 = __pyx_t_2;
18279 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18280 __pyx_v_dim = __pyx_t_4;
18289 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
18298 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
18307 if ((__pyx_v_suboffsets != 0)) {
18308 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
18312 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
18324 __Pyx_RefNannyFinishContext();
18335 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
18336 __Pyx_memviewslice __pyx_v_memviewslice;
18337 PyObject *__pyx_r = NULL;
18338 __Pyx_RefNannyDeclarations
18339 PyObject *__pyx_t_1 = NULL;
18340 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
18349 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
18358 __Pyx_XDECREF(__pyx_r);
18359 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
18360 __Pyx_GOTREF(__pyx_t_1);
18361 __pyx_r = __pyx_t_1;
18375 __Pyx_XDECREF(__pyx_t_1);
18376 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
18379 __Pyx_XGIVEREF(__pyx_r);
18380 __Pyx_RefNannyFinishContext();
18392 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
18393 PyObject *(*__pyx_v_to_object_func)(
char *);
18394 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
18395 PyObject *__pyx_r = NULL;
18396 __Pyx_RefNannyDeclarations
18399 PyObject *(*__pyx_t_3)(
char *);
18400 int (*__pyx_t_4)(
char *, PyObject *);
18401 PyObject *__pyx_t_5 = NULL;
18402 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
18411 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18412 __pyx_t_2 = (__pyx_t_1 != 0);
18422 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
18423 __pyx_v_to_object_func = __pyx_t_3;
18432 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
18433 __pyx_v_to_dtype_func = __pyx_t_4;
18453 __pyx_v_to_object_func = NULL;
18462 __pyx_v_to_dtype_func = NULL;
18473 __Pyx_XDECREF(__pyx_r);
18482 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
18483 __Pyx_GOTREF(__pyx_t_5);
18484 __pyx_r = __pyx_t_5;
18498 __Pyx_XDECREF(__pyx_t_5);
18499 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18502 __Pyx_XGIVEREF(__pyx_r);
18503 __Pyx_RefNannyFinishContext();
18515 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
18516 Py_ssize_t __pyx_r;
18526 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
18536 __pyx_r = (-__pyx_v_arg);
18556 __pyx_r = __pyx_v_arg;
18581 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
18583 Py_ssize_t __pyx_v_c_stride;
18584 Py_ssize_t __pyx_v_f_stride;
18598 __pyx_v_c_stride = 0;
18607 __pyx_v_f_stride = 0;
18616 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
18617 __pyx_v_i = __pyx_t_1;
18626 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18636 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18645 goto __pyx_L4_break;
18665 __pyx_t_1 = __pyx_v_ndim;
18666 __pyx_t_3 = __pyx_t_1;
18667 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18668 __pyx_v_i = __pyx_t_4;
18677 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18687 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18696 goto __pyx_L7_break;
18716 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
18771 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
18772 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18773 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
18774 Py_ssize_t __pyx_v_dst_extent;
18775 Py_ssize_t __pyx_v_src_stride;
18776 Py_ssize_t __pyx_v_dst_stride;
18780 Py_ssize_t __pyx_t_4;
18781 Py_ssize_t __pyx_t_5;
18782 Py_ssize_t __pyx_t_6;
18791 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
18800 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
18809 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
18818 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
18827 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
18837 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
18840 __pyx_t_1 = __pyx_t_2;
18841 goto __pyx_L5_bool_binop_done;
18843 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
18846 __pyx_t_1 = __pyx_t_2;
18847 goto __pyx_L5_bool_binop_done;
18857 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
18859 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
18861 __pyx_t_3 = (__pyx_t_2 != 0);
18862 __pyx_t_1 = __pyx_t_3;
18863 __pyx_L5_bool_binop_done:;
18881 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
18901 __pyx_t_4 = __pyx_v_dst_extent;
18902 __pyx_t_5 = __pyx_t_4;
18903 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18904 __pyx_v_i = __pyx_t_6;
18913 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
18922 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18931 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18954 __pyx_t_4 = __pyx_v_dst_extent;
18955 __pyx_t_5 = __pyx_t_4;
18956 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18957 __pyx_v_i = __pyx_t_6;
18966 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
18975 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18984 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
19008 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
19017 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
19038 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
19039 Py_ssize_t __pyx_v_shape;
19040 Py_ssize_t __pyx_v_size;
19041 Py_ssize_t __pyx_r;
19042 Py_ssize_t __pyx_t_1;
19043 Py_ssize_t *__pyx_t_2;
19044 Py_ssize_t *__pyx_t_3;
19045 Py_ssize_t *__pyx_t_4;
19054 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
19055 __pyx_v_size = __pyx_t_1;
19064 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
19065 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
19066 __pyx_t_2 = __pyx_t_4;
19067 __pyx_v_shape = (__pyx_t_2[0]);
19076 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
19086 __pyx_r = __pyx_v_size;
19110 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
19112 Py_ssize_t __pyx_r;
19125 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
19135 __pyx_t_2 = __pyx_v_ndim;
19136 __pyx_t_3 = __pyx_t_2;
19137 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19138 __pyx_v_idx = __pyx_t_4;
19147 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
19156 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
19177 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
19178 __pyx_v_idx = __pyx_t_2;
19187 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
19196 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
19208 __pyx_r = __pyx_v_stride;
19232 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
19234 void *__pyx_v_result;
19235 size_t __pyx_v_itemsize;
19236 size_t __pyx_v_size;
19238 Py_ssize_t __pyx_t_1;
19241 struct __pyx_memoryview_obj *__pyx_t_4;
19252 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
19253 __pyx_v_itemsize = __pyx_t_1;
19262 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
19271 __pyx_v_result = malloc(__pyx_v_size);
19280 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
19290 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
19308 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
19317 __pyx_t_4 = __pyx_v_src->memview;
19318 __pyx_v_tmpslice->memview = __pyx_t_4;
19327 __pyx_t_3 = __pyx_v_ndim;
19328 __pyx_t_5 = __pyx_t_3;
19329 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19330 __pyx_v_i = __pyx_t_6;
19339 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
19348 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1
L;
19358 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
19367 __pyx_t_3 = __pyx_v_ndim;
19368 __pyx_t_5 = __pyx_t_3;
19369 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19370 __pyx_v_i = __pyx_t_6;
19379 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
19389 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
19408 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
19418 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
19438 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
19449 __pyx_r = __pyx_v_result;
19464 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19466 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
19468 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19484 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
19486 __Pyx_RefNannyDeclarations
19487 PyObject *__pyx_t_1 = NULL;
19488 PyObject *__pyx_t_2 = NULL;
19489 PyObject *__pyx_t_3 = NULL;
19490 PyObject *__pyx_t_4 = NULL;
19492 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19494 __Pyx_RefNannySetupContext(
"_err_extents", 0);
19503 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
19504 __Pyx_GOTREF(__pyx_t_1);
19505 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
19506 __Pyx_GOTREF(__pyx_t_2);
19507 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
19508 __Pyx_GOTREF(__pyx_t_3);
19509 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
19510 __Pyx_GOTREF(__pyx_t_4);
19511 __Pyx_GIVEREF(__pyx_t_1);
19512 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
19513 __Pyx_GIVEREF(__pyx_t_2);
19514 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
19515 __Pyx_GIVEREF(__pyx_t_3);
19516 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
19528 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
19529 __Pyx_GOTREF(__pyx_t_3);
19530 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19531 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
19532 __Pyx_GOTREF(__pyx_t_4);
19533 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19534 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19535 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19536 __PYX_ERR(1, 1253, __pyx_L1_error)
19548 __Pyx_XDECREF(__pyx_t_1);
19549 __Pyx_XDECREF(__pyx_t_2);
19550 __Pyx_XDECREF(__pyx_t_3);
19551 __Pyx_XDECREF(__pyx_t_4);
19552 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19554 __Pyx_RefNannyFinishContext();
19556 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19569 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
19571 __Pyx_RefNannyDeclarations
19572 PyObject *__pyx_t_1 = NULL;
19573 PyObject *__pyx_t_2 = NULL;
19574 PyObject *__pyx_t_3 = NULL;
19575 PyObject *__pyx_t_4 = NULL;
19577 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19579 __Pyx_RefNannySetupContext(
"_err_dim", 0);
19580 __Pyx_INCREF(__pyx_v_error);
19589 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
19590 __Pyx_GOTREF(__pyx_t_2);
19591 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
19592 __Pyx_GOTREF(__pyx_t_3);
19593 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
19594 __Pyx_GOTREF(__pyx_t_4);
19595 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19596 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19597 __Pyx_INCREF(__pyx_v_error);
19598 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
19599 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
19600 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
19601 if (likely(__pyx_t_2)) {
19602 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
19603 __Pyx_INCREF(__pyx_t_2);
19604 __Pyx_INCREF(
function);
19605 __Pyx_DECREF_SET(__pyx_t_3,
function);
19608 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
19609 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
19610 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19611 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
19612 __Pyx_GOTREF(__pyx_t_1);
19613 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19614 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
19615 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19616 __PYX_ERR(1, 1258, __pyx_L1_error)
19628 __Pyx_XDECREF(__pyx_t_1);
19629 __Pyx_XDECREF(__pyx_t_2);
19630 __Pyx_XDECREF(__pyx_t_3);
19631 __Pyx_XDECREF(__pyx_t_4);
19632 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
19634 __Pyx_XDECREF(__pyx_v_error);
19635 __Pyx_RefNannyFinishContext();
19637 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19650 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
19652 __Pyx_RefNannyDeclarations
19654 PyObject *__pyx_t_2 = NULL;
19655 PyObject *__pyx_t_3 = NULL;
19656 PyObject *__pyx_t_4 = NULL;
19657 PyObject *__pyx_t_5 = NULL;
19659 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19661 __Pyx_RefNannySetupContext(
"_err", 0);
19662 __Pyx_INCREF(__pyx_v_error);
19671 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
19672 if (unlikely(__pyx_t_1)) {
19681 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
19682 __Pyx_GOTREF(__pyx_t_3);
19683 __Pyx_INCREF(__pyx_v_error);
19684 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
19685 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
19686 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
19687 if (likely(__pyx_t_5)) {
19688 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
19689 __Pyx_INCREF(__pyx_t_5);
19690 __Pyx_INCREF(
function);
19691 __Pyx_DECREF_SET(__pyx_t_4,
function);
19694 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
19695 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19696 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19697 if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
19698 __Pyx_GOTREF(__pyx_t_2);
19699 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19700 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
19701 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19702 __PYX_ERR(1, 1263, __pyx_L1_error)
19721 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
19722 __PYX_ERR(1, 1265, __pyx_L1_error)
19735 __Pyx_XDECREF(__pyx_t_2);
19736 __Pyx_XDECREF(__pyx_t_3);
19737 __Pyx_XDECREF(__pyx_t_4);
19738 __Pyx_XDECREF(__pyx_t_5);
19739 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
19741 __Pyx_XDECREF(__pyx_v_error);
19742 __Pyx_RefNannyFinishContext();
19744 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19757 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
19758 void *__pyx_v_tmpdata;
19759 size_t __pyx_v_itemsize;
19761 char __pyx_v_order;
19762 int __pyx_v_broadcasting;
19763 int __pyx_v_direct_copy;
19764 __Pyx_memviewslice __pyx_v_tmp;
19767 Py_ssize_t __pyx_t_1;
19783 __pyx_v_tmpdata = NULL;
19792 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
19793 __pyx_v_itemsize = __pyx_t_1;
19802 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
19811 __pyx_v_broadcasting = 0;
19820 __pyx_v_direct_copy = 0;
19829 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
19839 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
19858 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
19868 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
19887 __pyx_t_3 = __pyx_v_dst_ndim;
19888 __pyx_t_4 = __pyx_v_src_ndim;
19889 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
19890 __pyx_t_5 = __pyx_t_3;
19892 __pyx_t_5 = __pyx_t_4;
19894 __pyx_v_ndim = __pyx_t_5;
19903 __pyx_t_5 = __pyx_v_ndim;
19904 __pyx_t_3 = __pyx_t_5;
19905 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19906 __pyx_v_i = __pyx_t_4;
19915 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
19925 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
19935 __pyx_v_broadcasting = 1;
19944 (__pyx_v_src.strides[__pyx_v_i]) = 0;
19964 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
19984 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
19994 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
20013 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
20023 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
20033 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
20051 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
20052 __pyx_v_tmpdata = __pyx_t_7;
20061 __pyx_v_src = __pyx_v_tmp;
20079 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
20089 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
20099 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
20118 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
20128 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
20147 __pyx_t_2 = (__pyx_v_direct_copy != 0);
20157 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20166 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
20175 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20184 free(__pyx_v_tmpdata);
20221 __pyx_t_2 = (__pyx_v_order ==
'F');
20223 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
20225 __pyx_t_8 = (__pyx_t_2 != 0);
20235 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
20244 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
20262 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20271 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
20280 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20289 free(__pyx_v_tmpdata);
20313 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20315 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
20317 __Pyx_PyGILState_Release(__pyx_gilstate_save);
20333 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
20335 int __pyx_v_offset;
20347 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
20356 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
20357 __pyx_v_i = __pyx_t_1;
20366 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
20375 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
20384 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
20394 __pyx_t_1 = __pyx_v_offset;
20395 __pyx_t_2 = __pyx_t_1;
20396 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20397 __pyx_v_i = __pyx_t_3;
20406 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
20415 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
20424 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1
L;
20446 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
20456 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
20466 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
20496 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
20497 __Pyx_RefNannyDeclarations
20499 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20501 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
20510 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
20521 __Pyx_RefNannyFinishContext();
20523 __Pyx_PyGILState_Release(__pyx_gilstate_save);
20535 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
20536 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20537 __Pyx_RefNannyDeclarations
20538 Py_ssize_t __pyx_t_1;
20539 Py_ssize_t __pyx_t_2;
20540 Py_ssize_t __pyx_t_3;
20542 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
20551 __pyx_t_1 = (__pyx_v_shape[0]);
20552 __pyx_t_2 = __pyx_t_1;
20553 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20554 __pyx_v_i = __pyx_t_3;
20563 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
20573 __pyx_t_4 = (__pyx_v_inc != 0);
20583 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
20603 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
20633 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
20644 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
20656 __Pyx_RefNannyFinishContext();
20667 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
20676 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20685 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
20694 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20715 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
20716 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20717 Py_ssize_t __pyx_v_stride;
20718 Py_ssize_t __pyx_v_extent;
20720 Py_ssize_t __pyx_t_2;
20721 Py_ssize_t __pyx_t_3;
20722 Py_ssize_t __pyx_t_4;
20731 __pyx_v_stride = (__pyx_v_strides[0]);
20740 __pyx_v_extent = (__pyx_v_shape[0]);
20749 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
20759 __pyx_t_2 = __pyx_v_extent;
20760 __pyx_t_3 = __pyx_t_2;
20761 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20762 __pyx_v_i = __pyx_t_4;
20771 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
20780 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20801 __pyx_t_2 = __pyx_v_extent;
20802 __pyx_t_3 = __pyx_t_2;
20803 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20804 __pyx_v_i = __pyx_t_4;
20813 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
20822 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20845 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
20846 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
20847 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20848 PyObject *__pyx_v___pyx_type = 0;
20849 long __pyx_v___pyx_checksum;
20850 PyObject *__pyx_v___pyx_state = 0;
20851 PyObject *__pyx_r = 0;
20852 __Pyx_RefNannyDeclarations
20853 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
20855 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
20856 PyObject* values[3] = {0,0,0};
20857 if (unlikely(__pyx_kwds)) {
20858 Py_ssize_t kw_args;
20859 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20860 switch (pos_args) {
20861 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20862 CYTHON_FALLTHROUGH;
20863 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20864 CYTHON_FALLTHROUGH;
20865 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20866 CYTHON_FALLTHROUGH;
20868 default:
goto __pyx_L5_argtuple_error;
20870 kw_args = PyDict_Size(__pyx_kwds);
20871 switch (pos_args) {
20873 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
20874 else goto __pyx_L5_argtuple_error;
20875 CYTHON_FALLTHROUGH;
20877 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
20879 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
20881 CYTHON_FALLTHROUGH;
20883 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
20885 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
20888 if (unlikely(kw_args > 0)) {
20889 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
20891 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20892 goto __pyx_L5_argtuple_error;
20894 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20895 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20896 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20898 __pyx_v___pyx_type = values[0];
20899 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
20900 __pyx_v___pyx_state = values[2];
20902 goto __pyx_L4_argument_unpacking_done;
20903 __pyx_L5_argtuple_error:;
20904 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
20906 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20907 __Pyx_RefNannyFinishContext();
20909 __pyx_L4_argument_unpacking_done:;
20910 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
20913 __Pyx_RefNannyFinishContext();
20917 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
20918 PyObject *__pyx_v___pyx_PickleError = 0;
20919 PyObject *__pyx_v___pyx_result = 0;
20920 PyObject *__pyx_r = NULL;
20921 __Pyx_RefNannyDeclarations
20923 PyObject *__pyx_t_2 = NULL;
20924 PyObject *__pyx_t_3 = NULL;
20925 PyObject *__pyx_t_4 = NULL;
20926 PyObject *__pyx_t_5 = NULL;
20928 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
20937 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
20947 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20948 __Pyx_GOTREF(__pyx_t_2);
20949 __Pyx_INCREF(__pyx_n_s_PickleError);
20950 __Pyx_GIVEREF(__pyx_n_s_PickleError);
20951 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
20952 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
20953 __Pyx_GOTREF(__pyx_t_3);
20954 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20955 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20956 __Pyx_GOTREF(__pyx_t_2);
20957 __Pyx_INCREF(__pyx_t_2);
20958 __pyx_v___pyx_PickleError = __pyx_t_2;
20959 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20960 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20969 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
20970 __Pyx_GOTREF(__pyx_t_2);
20971 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
20972 __Pyx_GOTREF(__pyx_t_4);
20973 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20974 __Pyx_INCREF(__pyx_v___pyx_PickleError);
20975 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
20976 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
20977 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
20978 if (likely(__pyx_t_5)) {
20979 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
20980 __Pyx_INCREF(__pyx_t_5);
20981 __Pyx_INCREF(
function);
20982 __Pyx_DECREF_SET(__pyx_t_2,
function);
20985 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
20986 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20987 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20988 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
20989 __Pyx_GOTREF(__pyx_t_3);
20990 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20991 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20992 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20993 __PYX_ERR(1, 6, __pyx_L1_error)
21011 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
21012 __Pyx_GOTREF(__pyx_t_2);
21014 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
21015 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
21016 if (likely(__pyx_t_4)) {
21017 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
21018 __Pyx_INCREF(__pyx_t_4);
21019 __Pyx_INCREF(
function);
21020 __Pyx_DECREF_SET(__pyx_t_2,
function);
21023 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
21024 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
21025 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
21026 __Pyx_GOTREF(__pyx_t_3);
21027 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21028 __pyx_v___pyx_result = __pyx_t_3;
21038 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
21039 __pyx_t_6 = (__pyx_t_1 != 0);
21049 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
21050 __pyx_t_3 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
21051 __Pyx_GOTREF(__pyx_t_3);
21052 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21070 __Pyx_XDECREF(__pyx_r);
21071 __Pyx_INCREF(__pyx_v___pyx_result);
21072 __pyx_r = __pyx_v___pyx_result;
21083 __Pyx_XDECREF(__pyx_t_2);
21084 __Pyx_XDECREF(__pyx_t_3);
21085 __Pyx_XDECREF(__pyx_t_4);
21086 __Pyx_XDECREF(__pyx_t_5);
21087 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
21090 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
21091 __Pyx_XDECREF(__pyx_v___pyx_result);
21092 __Pyx_XGIVEREF(__pyx_r);
21093 __Pyx_RefNannyFinishContext();
21105 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
21106 PyObject *__pyx_r = NULL;
21107 __Pyx_RefNannyDeclarations
21108 PyObject *__pyx_t_1 = NULL;
21110 Py_ssize_t __pyx_t_3;
21113 PyObject *__pyx_t_6 = NULL;
21114 PyObject *__pyx_t_7 = NULL;
21115 PyObject *__pyx_t_8 = NULL;
21116 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
21125 if (unlikely(__pyx_v___pyx_state == Py_None)) {
21126 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
21127 __PYX_ERR(1, 12, __pyx_L1_error)
21129 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
21130 __Pyx_GOTREF(__pyx_t_1);
21131 __Pyx_GIVEREF(__pyx_t_1);
21132 __Pyx_GOTREF(__pyx_v___pyx_result->name);
21133 __Pyx_DECREF(__pyx_v___pyx_result->name);
21134 __pyx_v___pyx_result->name = __pyx_t_1;
21143 if (unlikely(__pyx_v___pyx_state == Py_None)) {
21144 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
21145 __PYX_ERR(1, 13, __pyx_L1_error)
21147 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
21148 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
21151 __pyx_t_2 = __pyx_t_4;
21152 goto __pyx_L4_bool_binop_done;
21154 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
21155 __pyx_t_5 = (__pyx_t_4 != 0);
21156 __pyx_t_2 = __pyx_t_5;
21157 __pyx_L4_bool_binop_done:;
21165 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
21166 __Pyx_GOTREF(__pyx_t_6);
21167 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
21168 __Pyx_GOTREF(__pyx_t_7);
21169 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21170 if (unlikely(__pyx_v___pyx_state == Py_None)) {
21171 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
21172 __PYX_ERR(1, 14, __pyx_L1_error)
21174 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
21175 __Pyx_GOTREF(__pyx_t_6);
21177 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
21178 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
21179 if (likely(__pyx_t_8)) {
21180 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
21181 __Pyx_INCREF(__pyx_t_8);
21182 __Pyx_INCREF(
function);
21183 __Pyx_DECREF_SET(__pyx_t_7,
function);
21186 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
21187 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
21188 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21189 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
21190 __Pyx_GOTREF(__pyx_t_1);
21191 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21192 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21211 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21214 __Pyx_XDECREF(__pyx_t_1);
21215 __Pyx_XDECREF(__pyx_t_6);
21216 __Pyx_XDECREF(__pyx_t_7);
21217 __Pyx_XDECREF(__pyx_t_8);
21218 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
21221 __Pyx_XGIVEREF(__pyx_r);
21222 __Pyx_RefNannyFinishContext();
21226 static PyObject *__pyx_tp_new_15superluWrappers_cSparseMatrix(PyTypeObject *t, PyObject *a, PyObject *k) {
21228 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21229 o = (*t->tp_alloc)(t, 0);
21231 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21233 if (unlikely(!o))
return 0;
21234 if (unlikely(__pyx_pw_15superluWrappers_13cSparseMatrix_1__cinit__(o, a, k) < 0))
goto bad;
21237 Py_DECREF(o); o = 0;
21241 static void __pyx_tp_dealloc_15superluWrappers_cSparseMatrix(PyObject *o) {
21242 #if CYTHON_USE_TP_FINALIZE 21243 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
21244 if (PyObject_CallFinalizerFromDealloc(o))
return;
21247 (*Py_TYPE(o)->tp_free)(o);
21250 static PyMethodDef __pyx_methods_15superluWrappers_cSparseMatrix[] = {
21251 {
"__reduce_cython__", (PyCFunction)__pyx_pw_15superluWrappers_13cSparseMatrix_3__reduce_cython__, METH_NOARGS, 0},
21252 {
"__setstate_cython__", (PyCFunction)__pyx_pw_15superluWrappers_13cSparseMatrix_5__setstate_cython__, METH_O, 0},
21256 static PyTypeObject __pyx_type_15superluWrappers_cSparseMatrix = {
21257 PyVarObject_HEAD_INIT(0, 0)
21258 "superluWrappers.cSparseMatrix",
21259 sizeof(
struct __pyx_obj_15superluWrappers_cSparseMatrix),
21261 __pyx_tp_dealloc_15superluWrappers_cSparseMatrix,
21262 #
if PY_VERSION_HEX < 0x030800b4
21265 #
if PY_VERSION_HEX >= 0x030800b4
21270 #
if PY_MAJOR_VERSION < 3
21273 #
if PY_MAJOR_VERSION >= 3
21286 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21294 __pyx_methods_15superluWrappers_cSparseMatrix,
21304 __pyx_tp_new_15superluWrappers_cSparseMatrix,
21314 #
if PY_VERSION_HEX >= 0x030400a1
21317 #
if PY_VERSION_HEX >= 0x030800b1
21320 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21324 static struct __pyx_vtabstruct_15superluWrappers_SparseFactor __pyx_vtable_15superluWrappers_SparseFactor;
21326 static PyObject *__pyx_tp_new_15superluWrappers_SparseFactor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
21327 struct __pyx_obj_15superluWrappers_SparseFactor *p;
21329 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21330 o = (*t->tp_alloc)(t, 0);
21332 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21334 if (unlikely(!o))
return 0;
21335 p = ((
struct __pyx_obj_15superluWrappers_SparseFactor *)o);
21336 p->__pyx_vtab = __pyx_vtabptr_15superluWrappers_SparseFactor;
21340 static void __pyx_tp_dealloc_15superluWrappers_SparseFactor(PyObject *o) {
21341 #if CYTHON_USE_TP_FINALIZE 21342 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
21343 if (PyObject_CallFinalizerFromDealloc(o))
return;
21346 (*Py_TYPE(o)->tp_free)(o);
21349 static PyObject *__pyx_getprop_15superluWrappers_12SparseFactor_dim(PyObject *o, CYTHON_UNUSED
void *x) {
21350 return __pyx_pw_15superluWrappers_12SparseFactor_3dim_1__get__(o);
21353 static int __pyx_setprop_15superluWrappers_12SparseFactor_dim(PyObject *o, PyObject *
v, CYTHON_UNUSED
void *x) {
21355 return __pyx_pw_15superluWrappers_12SparseFactor_3dim_3__set__(o,
v);
21358 PyErr_SetString(PyExc_NotImplementedError,
"__del__");
21363 static PyMethodDef __pyx_methods_15superluWrappers_SparseFactor[] = {
21364 {
"__reduce_cython__", (PyCFunction)__pyx_pw_15superluWrappers_12SparseFactor_3__reduce_cython__, METH_NOARGS, 0},
21365 {
"__setstate_cython__", (PyCFunction)__pyx_pw_15superluWrappers_12SparseFactor_5__setstate_cython__, METH_O, 0},
21369 static struct PyGetSetDef __pyx_getsets_15superluWrappers_SparseFactor[] = {
21370 {(
char *)
"dim", __pyx_getprop_15superluWrappers_12SparseFactor_dim, __pyx_setprop_15superluWrappers_12SparseFactor_dim, (
char *)0, 0},
21374 static PyTypeObject __pyx_type_15superluWrappers_SparseFactor = {
21375 PyVarObject_HEAD_INIT(0, 0)
21376 "superluWrappers.SparseFactor",
21377 sizeof(
struct __pyx_obj_15superluWrappers_SparseFactor),
21379 __pyx_tp_dealloc_15superluWrappers_SparseFactor,
21380 #
if PY_VERSION_HEX < 0x030800b4
21383 #
if PY_VERSION_HEX >= 0x030800b4
21388 #
if PY_MAJOR_VERSION < 3
21391 #
if PY_MAJOR_VERSION >= 3
21404 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21412 __pyx_methods_15superluWrappers_SparseFactor,
21414 __pyx_getsets_15superluWrappers_SparseFactor,
21420 __pyx_pw_15superluWrappers_12SparseFactor_1__init__,
21422 __pyx_tp_new_15superluWrappers_SparseFactor,
21432 #
if PY_VERSION_HEX >= 0x030400a1
21435 #
if PY_VERSION_HEX >= 0x030800b1
21438 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21442 static struct __pyx_vtabstruct_array __pyx_vtable_array;
21444 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
21445 struct __pyx_array_obj *p;
21447 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21448 o = (*t->tp_alloc)(t, 0);
21450 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21452 if (unlikely(!o))
return 0;
21453 p = ((
struct __pyx_array_obj *)o);
21454 p->__pyx_vtab = __pyx_vtabptr_array;
21455 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
21456 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
21457 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
21460 Py_DECREF(o); o = 0;
21464 static void __pyx_tp_dealloc_array(PyObject *o) {
21465 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
21466 #if CYTHON_USE_TP_FINALIZE 21467 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
21468 if (PyObject_CallFinalizerFromDealloc(o))
return;
21472 PyObject *etype, *eval, *etb;
21473 PyErr_Fetch(&etype, &eval, &etb);
21475 __pyx_array___dealloc__(o);
21477 PyErr_Restore(etype, eval, etb);
21480 Py_CLEAR(p->_format);
21481 (*Py_TYPE(o)->tp_free)(o);
21483 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
21485 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
21486 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21491 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *
v) {
21493 return __pyx_array___setitem__(o, i, v);
21496 PyErr_Format(PyExc_NotImplementedError,
21497 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21502 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *
n) {
21503 PyObject *
v = __Pyx_PyObject_GenericGetAttr(o, n);
21504 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
21506 v = __pyx_array___getattr__(o, n);
21511 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
21512 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
21515 static PyMethodDef __pyx_methods_array[] = {
21516 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
21517 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
21518 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
21522 static struct PyGetSetDef __pyx_getsets_array[] = {
21523 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
21527 static PySequenceMethods __pyx_tp_as_sequence_array = {
21528 __pyx_array___len__,
21531 __pyx_sq_item_array,
21540 static PyMappingMethods __pyx_tp_as_mapping_array = {
21541 __pyx_array___len__,
21542 __pyx_array___getitem__,
21543 __pyx_mp_ass_subscript_array,
21546 static PyBufferProcs __pyx_tp_as_buffer_array = {
21547 #if PY_MAJOR_VERSION < 3 21550 #if PY_MAJOR_VERSION < 3 21553 #if PY_MAJOR_VERSION < 3 21556 #if PY_MAJOR_VERSION < 3 21559 __pyx_array_getbuffer,
21563 static PyTypeObject __pyx_type___pyx_array = {
21564 PyVarObject_HEAD_INIT(0, 0)
21565 "superluWrappers.array",
21566 sizeof(
struct __pyx_array_obj),
21568 __pyx_tp_dealloc_array,
21569 #
if PY_VERSION_HEX < 0x030800b4
21572 #
if PY_VERSION_HEX >= 0x030800b4
21577 #
if PY_MAJOR_VERSION < 3
21580 #
if PY_MAJOR_VERSION >= 3
21585 &__pyx_tp_as_sequence_array,
21586 &__pyx_tp_as_mapping_array,
21590 __pyx_tp_getattro_array,
21592 &__pyx_tp_as_buffer_array,
21593 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21601 __pyx_methods_array,
21603 __pyx_getsets_array,
21611 __pyx_tp_new_array,
21621 #
if PY_VERSION_HEX >= 0x030400a1
21624 #
if PY_VERSION_HEX >= 0x030800b1
21627 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21632 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
21633 struct __pyx_MemviewEnum_obj *p;
21635 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21636 o = (*t->tp_alloc)(t, 0);
21638 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21640 if (unlikely(!o))
return 0;
21641 p = ((
struct __pyx_MemviewEnum_obj *)o);
21642 p->name = Py_None; Py_INCREF(Py_None);
21646 static void __pyx_tp_dealloc_Enum(PyObject *o) {
21647 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21648 #if CYTHON_USE_TP_FINALIZE 21649 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21650 if (PyObject_CallFinalizerFromDealloc(o))
return;
21653 PyObject_GC_UnTrack(o);
21655 (*Py_TYPE(o)->tp_free)(o);
21658 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc
v,
void *a) {
21660 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21662 e = (*v)(p->name, a);
if (e)
return e;
21667 static int __pyx_tp_clear_Enum(PyObject *o) {
21669 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21670 tmp = ((PyObject*)p->name);
21671 p->name = Py_None; Py_INCREF(Py_None);
21676 static PyMethodDef __pyx_methods_Enum[] = {
21677 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
21678 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
21682 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
21683 PyVarObject_HEAD_INIT(0, 0)
21684 "superluWrappers.Enum",
21685 sizeof(
struct __pyx_MemviewEnum_obj),
21687 __pyx_tp_dealloc_Enum,
21688 #
if PY_VERSION_HEX < 0x030800b4
21691 #
if PY_VERSION_HEX >= 0x030800b4
21696 #
if PY_MAJOR_VERSION < 3
21699 #
if PY_MAJOR_VERSION >= 3
21702 __pyx_MemviewEnum___repr__,
21712 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21714 __pyx_tp_traverse_Enum,
21715 __pyx_tp_clear_Enum,
21720 __pyx_methods_Enum,
21728 __pyx_MemviewEnum___init__,
21740 #
if PY_VERSION_HEX >= 0x030400a1
21743 #
if PY_VERSION_HEX >= 0x030800b1
21746 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21750 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
21752 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
21753 struct __pyx_memoryview_obj *p;
21755 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21756 o = (*t->tp_alloc)(t, 0);
21758 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21760 if (unlikely(!o))
return 0;
21761 p = ((
struct __pyx_memoryview_obj *)o);
21762 p->__pyx_vtab = __pyx_vtabptr_memoryview;
21763 p->obj = Py_None; Py_INCREF(Py_None);
21764 p->_size = Py_None; Py_INCREF(Py_None);
21765 p->_array_interface = Py_None; Py_INCREF(Py_None);
21766 p->view.obj = NULL;
21767 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
21770 Py_DECREF(o); o = 0;
21774 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
21775 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21776 #if CYTHON_USE_TP_FINALIZE 21777 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21778 if (PyObject_CallFinalizerFromDealloc(o))
return;
21781 PyObject_GC_UnTrack(o);
21783 PyObject *etype, *eval, *etb;
21784 PyErr_Fetch(&etype, &eval, &etb);
21786 __pyx_memoryview___dealloc__(o);
21788 PyErr_Restore(etype, eval, etb);
21791 Py_CLEAR(p->_size);
21792 Py_CLEAR(p->_array_interface);
21793 (*Py_TYPE(o)->tp_free)(o);
21796 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc
v,
void *a) {
21798 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21800 e = (*v)(p->obj, a);
if (e)
return e;
21803 e = (*v)(p->_size, a);
if (e)
return e;
21805 if (p->_array_interface) {
21806 e = (*v)(p->_array_interface, a);
if (e)
return e;
21809 e = (*v)(p->view.obj, a);
if (e)
return e;
21814 static int __pyx_tp_clear_memoryview(PyObject *o) {
21816 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21817 tmp = ((PyObject*)p->obj);
21818 p->obj = Py_None; Py_INCREF(Py_None);
21820 tmp = ((PyObject*)p->_size);
21821 p->_size = Py_None; Py_INCREF(Py_None);
21823 tmp = ((PyObject*)p->_array_interface);
21824 p->_array_interface = Py_None; Py_INCREF(Py_None);
21826 Py_CLEAR(p->view.obj);
21829 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
21831 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
21832 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21837 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *
v) {
21839 return __pyx_memoryview___setitem__(o, i, v);
21842 PyErr_Format(PyExc_NotImplementedError,
21843 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21848 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
21849 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
21852 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
21853 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
21856 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
21857 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
21860 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
21861 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
21864 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
21865 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
21868 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
21869 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
21872 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
21873 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
21876 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
21877 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
21880 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
21881 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
21884 static PyMethodDef __pyx_methods_memoryview[] = {
21885 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
21886 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
21887 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
21888 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
21889 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
21890 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
21894 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
21895 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
21896 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
21897 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
21898 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
21899 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
21900 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
21901 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
21902 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
21903 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
21907 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
21908 __pyx_memoryview___len__,
21911 __pyx_sq_item_memoryview,
21920 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
21921 __pyx_memoryview___len__,
21922 __pyx_memoryview___getitem__,
21923 __pyx_mp_ass_subscript_memoryview,
21926 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
21927 #if PY_MAJOR_VERSION < 3 21930 #if PY_MAJOR_VERSION < 3 21933 #if PY_MAJOR_VERSION < 3 21936 #if PY_MAJOR_VERSION < 3 21939 __pyx_memoryview_getbuffer,
21943 static PyTypeObject __pyx_type___pyx_memoryview = {
21944 PyVarObject_HEAD_INIT(0, 0)
21945 "superluWrappers.memoryview",
21946 sizeof(
struct __pyx_memoryview_obj),
21948 __pyx_tp_dealloc_memoryview,
21949 #
if PY_VERSION_HEX < 0x030800b4
21952 #
if PY_VERSION_HEX >= 0x030800b4
21957 #
if PY_MAJOR_VERSION < 3
21960 #
if PY_MAJOR_VERSION >= 3
21963 __pyx_memoryview___repr__,
21965 &__pyx_tp_as_sequence_memoryview,
21966 &__pyx_tp_as_mapping_memoryview,
21969 __pyx_memoryview___str__,
21972 &__pyx_tp_as_buffer_memoryview,
21973 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21975 __pyx_tp_traverse_memoryview,
21976 __pyx_tp_clear_memoryview,
21981 __pyx_methods_memoryview,
21983 __pyx_getsets_memoryview,
21991 __pyx_tp_new_memoryview,
22001 #
if PY_VERSION_HEX >= 0x030400a1
22004 #
if PY_VERSION_HEX >= 0x030800b1
22007 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
22011 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
22013 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
22014 struct __pyx_memoryviewslice_obj *p;
22015 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
22016 if (unlikely(!o))
return 0;
22017 p = ((
struct __pyx_memoryviewslice_obj *)o);
22018 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
22019 p->from_object = Py_None; Py_INCREF(Py_None);
22020 p->from_slice.memview = NULL;
22024 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
22025 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
22026 #if CYTHON_USE_TP_FINALIZE 22027 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
22028 if (PyObject_CallFinalizerFromDealloc(o))
return;
22031 PyObject_GC_UnTrack(o);
22033 PyObject *etype, *eval, *etb;
22034 PyErr_Fetch(&etype, &eval, &etb);
22036 __pyx_memoryviewslice___dealloc__(o);
22038 PyErr_Restore(etype, eval, etb);
22040 Py_CLEAR(p->from_object);
22041 PyObject_GC_Track(o);
22042 __pyx_tp_dealloc_memoryview(o);
22045 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc
v,
void *a) {
22047 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
22048 e = __pyx_tp_traverse_memoryview(o,
v, a);
if (e)
return e;
22049 if (p->from_object) {
22050 e = (*v)(p->from_object, a);
if (e)
return e;
22055 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
22057 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
22058 __pyx_tp_clear_memoryview(o);
22059 tmp = ((PyObject*)p->from_object);
22060 p->from_object = Py_None; Py_INCREF(Py_None);
22062 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
22066 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
22067 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
22070 static PyMethodDef __pyx_methods__memoryviewslice[] = {
22071 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
22072 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
22076 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
22077 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
22081 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
22082 PyVarObject_HEAD_INIT(0, 0)
22083 "superluWrappers._memoryviewslice",
22084 sizeof(
struct __pyx_memoryviewslice_obj),
22086 __pyx_tp_dealloc__memoryviewslice,
22087 #
if PY_VERSION_HEX < 0x030800b4
22090 #
if PY_VERSION_HEX >= 0x030800b4
22095 #
if PY_MAJOR_VERSION < 3
22098 #
if PY_MAJOR_VERSION >= 3
22101 #
if CYTHON_COMPILING_IN_PYPY
22102 __pyx_memoryview___repr__,
22111 #
if CYTHON_COMPILING_IN_PYPY
22112 __pyx_memoryview___str__,
22119 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
22120 "Internal class for passing memoryview slices to Python",
22121 __pyx_tp_traverse__memoryviewslice,
22122 __pyx_tp_clear__memoryviewslice,
22127 __pyx_methods__memoryviewslice,
22129 __pyx_getsets__memoryviewslice,
22137 __pyx_tp_new__memoryviewslice,
22147 #
if PY_VERSION_HEX >= 0x030400a1
22150 #
if PY_VERSION_HEX >= 0x030800b1
22153 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
22158 static PyMethodDef __pyx_methods[] = {
22162 #if PY_MAJOR_VERSION >= 3 22163 #if CYTHON_PEP489_MULTI_PHASE_INIT 22164 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
22165 static int __pyx_pymod_exec_superluWrappers(PyObject* module);
22166 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
22167 {Py_mod_create, (
void*)__pyx_pymod_create},
22168 {Py_mod_exec, (
void*)__pyx_pymod_exec_superluWrappers},
22173 static struct PyModuleDef __pyx_moduledef = {
22174 PyModuleDef_HEAD_INIT,
22177 #if CYTHON_PEP489_MULTI_PHASE_INIT 22183 #if CYTHON_PEP489_MULTI_PHASE_INIT 22184 __pyx_moduledef_slots,
22193 #ifndef CYTHON_SMALL_CODE 22194 #if defined(__clang__) 22195 #define CYTHON_SMALL_CODE 22196 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 22197 #define CYTHON_SMALL_CODE __attribute__((cold)) 22199 #define CYTHON_SMALL_CODE 22203 static __Pyx_StringTabEntry __pyx_string_tab[] = {
22204 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
22205 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
22206 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
22207 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
22208 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
22209 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
22210 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
22211 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
22212 {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor,
sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
22213 {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2,
sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
22214 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22215 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0,
sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
22216 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
22217 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
22218 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
22219 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
22220 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
22221 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
22222 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
22223 {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor,
sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
22224 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
22225 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
22226 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
22227 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError,
sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
22228 {&__pyx_n_s_SparseFactor, __pyx_k_SparseFactor,
sizeof(__pyx_k_SparseFactor), 0, 0, 1, 1},
22229 {&__pyx_n_s_SparseMatrix, __pyx_k_SparseMatrix,
sizeof(__pyx_k_SparseMatrix), 0, 0, 1, 1},
22230 {&__pyx_n_s_SparseMatrix___init, __pyx_k_SparseMatrix___init,
sizeof(__pyx_k_SparseMatrix___init), 0, 0, 1, 1},
22231 {&__pyx_n_s_SparseMatrix_fwrite, __pyx_k_SparseMatrix_fwrite,
sizeof(__pyx_k_SparseMatrix_fwrite), 0, 0, 1, 1},
22232 {&__pyx_n_s_SparseMatrix_getCSRrepresentatio, __pyx_k_SparseMatrix_getCSRrepresentatio,
sizeof(__pyx_k_SparseMatrix_getCSRrepresentatio), 0, 0, 1, 1},
22233 {&__pyx_n_s_SparseMatrix_getSubMatCSRreprese, __pyx_k_SparseMatrix_getSubMatCSRreprese,
sizeof(__pyx_k_SparseMatrix_getSubMatCSRreprese), 0, 0, 1, 1},
22234 {&__pyx_n_s_SparseMatrix_matvec, __pyx_k_SparseMatrix_matvec,
sizeof(__pyx_k_SparseMatrix_matvec), 0, 0, 1, 1},
22235 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
22236 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
22237 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
22238 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
22239 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
22240 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
22241 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
22242 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
22243 {&__pyx_n_s_cSparseMatrix, __pyx_k_cSparseMatrix,
sizeof(__pyx_k_cSparseMatrix), 0, 0, 1, 1},
22244 {&__pyx_n_s_cSparseMatrix_2, __pyx_k_cSparseMatrix_2,
sizeof(__pyx_k_cSparseMatrix_2), 0, 0, 1, 1},
22245 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
22246 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22247 {&__pyx_n_s_colind, __pyx_k_colind,
sizeof(__pyx_k_colind), 0, 0, 1, 1},
22248 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
22249 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
22250 {&__pyx_kp_s_d_d_13_8e, __pyx_k_d_d_13_8e,
sizeof(__pyx_k_d_d_13_8e), 0, 0, 1, 0},
22251 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
22252 {&__pyx_n_s_dim, __pyx_k_dim,
sizeof(__pyx_k_dim), 0, 0, 1, 1},
22253 {&__pyx_n_s_doc, __pyx_k_doc,
sizeof(__pyx_k_doc), 0, 0, 1, 1},
22254 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
22255 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
22256 {&__pyx_n_s_enter, __pyx_k_enter,
sizeof(__pyx_k_enter), 0, 0, 1, 1},
22257 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
22258 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
22259 {&__pyx_n_s_exit, __pyx_k_exit,
sizeof(__pyx_k_exit), 0, 0, 1, 1},
22260 {&__pyx_n_s_filename, __pyx_k_filename,
sizeof(__pyx_k_filename), 0, 0, 1, 1},
22261 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
22262 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
22263 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
22264 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
22265 {&__pyx_n_s_fwrite, __pyx_k_fwrite,
sizeof(__pyx_k_fwrite), 0, 0, 1, 1},
22266 {&__pyx_n_s_getCSRrepresentation, __pyx_k_getCSRrepresentation,
sizeof(__pyx_k_getCSRrepresentation), 0, 0, 1, 1},
22267 {&__pyx_n_s_getSubMatCSRrepresentation, __pyx_k_getSubMatCSRrepresentation,
sizeof(__pyx_k_getSubMatCSRrepresentation), 0, 0, 1, 1},
22268 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
22269 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
22270 {&__pyx_n_s_i, __pyx_k_i,
sizeof(__pyx_k_i), 0, 0, 1, 1},
22271 {&__pyx_kp_s_i_i_i, __pyx_k_i_i_i,
sizeof(__pyx_k_i_i_i), 0, 0, 1, 0},
22272 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
22273 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
22274 {&__pyx_n_s_init, __pyx_k_init,
sizeof(__pyx_k_init), 0, 0, 1, 1},
22275 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
22276 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
22277 {&__pyx_n_s_k, __pyx_k_k,
sizeof(__pyx_k_k), 0, 0, 1, 1},
22278 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
22279 {&__pyx_n_s_matvec, __pyx_k_matvec,
sizeof(__pyx_k_matvec), 0, 0, 1, 1},
22280 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
22281 {&__pyx_n_s_metaclass, __pyx_k_metaclass,
sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
22282 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
22283 {&__pyx_n_s_module, __pyx_k_module,
sizeof(__pyx_k_module), 0, 0, 1, 1},
22284 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
22285 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
22286 {&__pyx_n_s_nc, __pyx_k_nc,
sizeof(__pyx_k_nc), 0, 0, 1, 1},
22287 {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous,
sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
22288 {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou,
sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
22289 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
22290 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
22291 {&__pyx_n_s_nnz, __pyx_k_nnz,
sizeof(__pyx_k_nnz), 0, 0, 1, 1},
22292 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
22293 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
22294 {&__pyx_n_s_nr, __pyx_k_nr,
sizeof(__pyx_k_nr), 0, 0, 1, 1},
22295 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22296 {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to,
sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
22297 {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor,
sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
22298 {&__pyx_n_s_nzval, __pyx_k_nzval,
sizeof(__pyx_k_nzval), 0, 0, 1, 1},
22299 {&__pyx_n_s_nzvals, __pyx_k_nzvals,
sizeof(__pyx_k_nzvals), 0, 0, 1, 1},
22300 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
22301 {&__pyx_n_s_object, __pyx_k_object,
sizeof(__pyx_k_object), 0, 0, 1, 1},
22302 {&__pyx_n_s_open, __pyx_k_open,
sizeof(__pyx_k_open), 0, 0, 1, 1},
22303 {&__pyx_n_s_output_file, __pyx_k_output_file,
sizeof(__pyx_k_output_file), 0, 0, 1, 1},
22304 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
22305 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
22306 {&__pyx_n_s_prepare, __pyx_k_prepare,
sizeof(__pyx_k_prepare), 0, 0, 1, 1},
22307 {&__pyx_kp_s_proteus_superluWrappers_pyx, __pyx_k_proteus_superluWrappers_pyx,
sizeof(__pyx_k_proteus_superluWrappers_pyx), 0, 0, 1, 0},
22308 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
22309 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
22310 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
22311 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
22312 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
22313 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
22314 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
22315 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
22316 {&__pyx_n_s_qualname, __pyx_k_qualname,
sizeof(__pyx_k_qualname), 0, 0, 1, 1},
22317 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
22318 {&__pyx_n_s_range_end, __pyx_k_range_end,
sizeof(__pyx_k_range_end), 0, 0, 1, 1},
22319 {&__pyx_n_s_range_start, __pyx_k_range_start,
sizeof(__pyx_k_range_start), 0, 0, 1, 1},
22320 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
22321 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
22322 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
22323 {&__pyx_n_s_rowptr, __pyx_k_rowptr,
sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
22324 {&__pyx_n_s_rows, __pyx_k_rows,
sizeof(__pyx_k_rows), 0, 0, 1, 1},
22325 {&__pyx_n_s_self, __pyx_k_self,
sizeof(__pyx_k_self), 0, 0, 1, 1},
22326 {&__pyx_kp_s_self_A_self_AC_self_L_self_U_sel, __pyx_k_self_A_self_AC_self_L_self_U_sel,
sizeof(__pyx_k_self_A_self_AC_self_L_self_U_sel), 0, 0, 1, 0},
22327 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
22328 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
22329 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
22330 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
22331 {&__pyx_n_s_sparseFactor, __pyx_k_sparseFactor,
sizeof(__pyx_k_sparseFactor), 0, 0, 1, 1},
22332 {&__pyx_n_s_sparseFactorPrepare, __pyx_k_sparseFactorPrepare,
sizeof(__pyx_k_sparseFactorPrepare), 0, 0, 1, 1},
22333 {&__pyx_n_s_sparseFactorSolve, __pyx_k_sparseFactorSolve,
sizeof(__pyx_k_sparseFactorSolve), 0, 0, 1, 1},
22334 {&__pyx_n_s_sparse_matrix, __pyx_k_sparse_matrix,
sizeof(__pyx_k_sparse_matrix), 0, 0, 1, 1},
22335 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
22336 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
22337 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
22338 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
22339 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
22340 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
22341 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
22342 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
22343 {&__pyx_n_s_superluWrappers, __pyx_k_superluWrappers,
sizeof(__pyx_k_superluWrappers), 0, 0, 1, 1},
22344 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
22345 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
22346 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
22347 {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd,
sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
22348 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
22349 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
22350 {&__pyx_n_s_w, __pyx_k_w,
sizeof(__pyx_k_w), 0, 0, 1, 1},
22351 {&__pyx_n_s_write, __pyx_k_write,
sizeof(__pyx_k_write), 0, 0, 1, 1},
22352 {&__pyx_n_s_x, __pyx_k_x,
sizeof(__pyx_k_x), 0, 0, 1, 1},
22353 {&__pyx_n_s_y, __pyx_k_y,
sizeof(__pyx_k_y), 0, 0, 1, 1},
22354 {0, 0, 0, 0, 0, 0, 0}
22356 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
22357 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object);
if (!__pyx_builtin_object) __PYX_ERR(0, 13, __pyx_L1_error)
22358 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open);
if (!__pyx_builtin_open) __PYX_ERR(0, 56, __pyx_L1_error)
22359 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 58, __pyx_L1_error)
22360 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
22361 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(2, 272, __pyx_L1_error)
22362 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError);
if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 856, __pyx_L1_error)
22363 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
22364 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
22365 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
22366 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
22367 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
22368 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
22374 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
22375 __Pyx_RefNannyDeclarations
22376 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
22385 __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 56, __pyx_L1_error)
22386 __Pyx_GOTREF(__pyx_tuple_);
22387 __Pyx_GIVEREF(__pyx_tuple_);
22395 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
22396 __Pyx_GOTREF(__pyx_tuple__2);
22397 __Pyx_GIVEREF(__pyx_tuple__2);
22404 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
22405 __Pyx_GOTREF(__pyx_tuple__3);
22406 __Pyx_GIVEREF(__pyx_tuple__3);
22414 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self_A_self_AC_self_L_self_U_sel);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
22415 __Pyx_GOTREF(__pyx_tuple__4);
22416 __Pyx_GIVEREF(__pyx_tuple__4);
22423 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_A_self_AC_self_L_self_U_sel);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
22424 __Pyx_GOTREF(__pyx_tuple__5);
22425 __Pyx_GIVEREF(__pyx_tuple__5);
22434 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 272, __pyx_L1_error)
22435 __Pyx_GOTREF(__pyx_tuple__6);
22436 __Pyx_GIVEREF(__pyx_tuple__6);
22445 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 276, __pyx_L1_error)
22446 __Pyx_GOTREF(__pyx_tuple__7);
22447 __Pyx_GIVEREF(__pyx_tuple__7);
22456 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 306, __pyx_L1_error)
22457 __Pyx_GOTREF(__pyx_tuple__8);
22458 __Pyx_GIVEREF(__pyx_tuple__8);
22467 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 856, __pyx_L1_error)
22468 __Pyx_GOTREF(__pyx_tuple__9);
22469 __Pyx_GIVEREF(__pyx_tuple__9);
22478 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 880, __pyx_L1_error)
22479 __Pyx_GOTREF(__pyx_tuple__10);
22480 __Pyx_GIVEREF(__pyx_tuple__10);
22489 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 1038, __pyx_L1_error)
22490 __Pyx_GOTREF(__pyx_tuple__11);
22491 __Pyx_GIVEREF(__pyx_tuple__11);
22500 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 1044, __pyx_L1_error)
22501 __Pyx_GOTREF(__pyx_tuple__12);
22502 __Pyx_GIVEREF(__pyx_tuple__12);
22511 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 133, __pyx_L1_error)
22512 __Pyx_GOTREF(__pyx_tuple__13);
22513 __Pyx_GIVEREF(__pyx_tuple__13);
22522 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 136, __pyx_L1_error)
22523 __Pyx_GOTREF(__pyx_tuple__14);
22524 __Pyx_GIVEREF(__pyx_tuple__14);
22533 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 148, __pyx_L1_error)
22534 __Pyx_GOTREF(__pyx_tuple__15);
22535 __Pyx_GIVEREF(__pyx_tuple__15);
22544 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 176, __pyx_L1_error)
22545 __Pyx_GOTREF(__pyx_tuple__16);
22546 __Pyx_GIVEREF(__pyx_tuple__16);
22555 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 192, __pyx_L1_error)
22556 __Pyx_GOTREF(__pyx_tuple__17);
22557 __Pyx_GIVEREF(__pyx_tuple__17);
22565 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2, __pyx_L1_error)
22566 __Pyx_GOTREF(__pyx_tuple__18);
22567 __Pyx_GIVEREF(__pyx_tuple__18);
22574 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 4, __pyx_L1_error)
22575 __Pyx_GOTREF(__pyx_tuple__19);
22576 __Pyx_GIVEREF(__pyx_tuple__19);
22585 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 418, __pyx_L1_error)
22586 __Pyx_GOTREF(__pyx_tuple__20);
22587 __Pyx_GIVEREF(__pyx_tuple__20);
22596 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 495, __pyx_L1_error)
22597 __Pyx_GOTREF(__pyx_tuple__21);
22598 __Pyx_GIVEREF(__pyx_tuple__21);
22607 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 520, __pyx_L1_error)
22608 __Pyx_GOTREF(__pyx_tuple__22);
22609 __Pyx_GIVEREF(__pyx_tuple__22);
22618 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 570, __pyx_L1_error)
22619 __Pyx_GOTREF(__pyx_tuple__23);
22620 __Pyx_GIVEREF(__pyx_tuple__23);
22629 __pyx_tuple__24 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 577, __pyx_L1_error)
22630 __Pyx_GOTREF(__pyx_tuple__24);
22631 __Pyx_INCREF(__pyx_int_neg_1);
22632 __Pyx_GIVEREF(__pyx_int_neg_1);
22633 PyTuple_SET_ITEM(__pyx_tuple__24, 0, __pyx_int_neg_1);
22634 __Pyx_GIVEREF(__pyx_tuple__24);
22642 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 2, __pyx_L1_error)
22643 __Pyx_GOTREF(__pyx_tuple__25);
22644 __Pyx_GIVEREF(__pyx_tuple__25);
22651 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error)
22652 __Pyx_GOTREF(__pyx_tuple__26);
22653 __Pyx_GIVEREF(__pyx_tuple__26);
22662 __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__27)) __PYX_ERR(1, 682, __pyx_L1_error)
22663 __Pyx_GOTREF(__pyx_slice__27);
22664 __Pyx_GIVEREF(__pyx_slice__27);
22673 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 703, __pyx_L1_error)
22674 __Pyx_GOTREF(__pyx_tuple__28);
22675 __Pyx_GIVEREF(__pyx_tuple__28);
22683 __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 2, __pyx_L1_error)
22684 __Pyx_GOTREF(__pyx_tuple__29);
22685 __Pyx_GIVEREF(__pyx_tuple__29);
22692 __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 4, __pyx_L1_error)
22693 __Pyx_GOTREF(__pyx_tuple__30);
22694 __Pyx_GIVEREF(__pyx_tuple__30);
22703 __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object);
if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 13, __pyx_L1_error)
22704 __Pyx_GOTREF(__pyx_tuple__31);
22705 __Pyx_GIVEREF(__pyx_tuple__31);
22714 __pyx_tuple__32 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_nr, __pyx_n_s_nc, __pyx_n_s_nnz, __pyx_n_s_nzvals, __pyx_n_s_colind, __pyx_n_s_rowptr);
if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 15, __pyx_L1_error)
22715 __Pyx_GOTREF(__pyx_tuple__32);
22716 __Pyx_GIVEREF(__pyx_tuple__32);
22717 __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_init, 15, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 15, __pyx_L1_error)
22726 __pyx_tuple__34 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_x, __pyx_n_s_y);
if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 35, __pyx_L1_error)
22727 __Pyx_GOTREF(__pyx_tuple__34);
22728 __Pyx_GIVEREF(__pyx_tuple__34);
22729 __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_matvec, 35, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 35, __pyx_L1_error)
22738 __pyx_tuple__36 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_filename, __pyx_n_s_base, __pyx_n_s_output_file, __pyx_n_s_i, __pyx_n_s_k);
if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 46, __pyx_L1_error)
22739 __Pyx_GOTREF(__pyx_tuple__36);
22740 __Pyx_GIVEREF(__pyx_tuple__36);
22741 __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_fwrite, 46, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 46, __pyx_L1_error)
22750 __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self);
if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 62, __pyx_L1_error)
22751 __Pyx_GOTREF(__pyx_tuple__38);
22752 __Pyx_GIVEREF(__pyx_tuple__38);
22753 __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_getCSRrepresentation, 62, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 62, __pyx_L1_error)
22762 __pyx_tuple__40 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_range_start, __pyx_n_s_range_end, __pyx_n_s_rows, __pyx_n_s_nnz, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nzvals);
if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 72, __pyx_L1_error)
22763 __Pyx_GOTREF(__pyx_tuple__40);
22764 __Pyx_GIVEREF(__pyx_tuple__40);
22765 __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_getSubMatCSRrepresentation, 72, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 72, __pyx_L1_error)
22774 __pyx_tuple__42 = PyTuple_Pack(2, __pyx_n_s_sparse_matrix, __pyx_n_s_sparseFactor);
if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 219, __pyx_L1_error)
22775 __Pyx_GOTREF(__pyx_tuple__42);
22776 __Pyx_GIVEREF(__pyx_tuple__42);
22777 __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_sparseFactorPrepare, 219, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 219, __pyx_L1_error)
22786 __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_sparseFactor, __pyx_n_s_x);
if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 286, __pyx_L1_error)
22787 __Pyx_GOTREF(__pyx_tuple__44);
22788 __Pyx_GIVEREF(__pyx_tuple__44);
22789 __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_superluWrappers_pyx, __pyx_n_s_sparseFactorSolve, 286, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 286, __pyx_L1_error)
22798 __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 286, __pyx_L1_error)
22799 __Pyx_GOTREF(__pyx_tuple__46);
22800 __Pyx_GIVEREF(__pyx_tuple__46);
22809 __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 287, __pyx_L1_error)
22810 __Pyx_GOTREF(__pyx_tuple__47);
22811 __Pyx_GIVEREF(__pyx_tuple__47);
22820 __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 288, __pyx_L1_error)
22821 __Pyx_GOTREF(__pyx_tuple__48);
22822 __Pyx_GIVEREF(__pyx_tuple__48);
22831 __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__49)) __PYX_ERR(1, 291, __pyx_L1_error)
22832 __Pyx_GOTREF(__pyx_tuple__49);
22833 __Pyx_GIVEREF(__pyx_tuple__49);
22842 __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__50)) __PYX_ERR(1, 292, __pyx_L1_error)
22843 __Pyx_GOTREF(__pyx_tuple__50);
22844 __Pyx_GIVEREF(__pyx_tuple__50);
22851 __pyx_tuple__51 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__51)) __PYX_ERR(1, 1, __pyx_L1_error)
22852 __Pyx_GOTREF(__pyx_tuple__51);
22853 __Pyx_GIVEREF(__pyx_tuple__51);
22854 __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(1, 1, __pyx_L1_error)
22855 __Pyx_RefNannyFinishContext();
22858 __Pyx_RefNannyFinishContext();
22862 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
22863 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22864 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22865 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22866 __pyx_int_184977713 = PyInt_FromLong(184977713
L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
22867 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22873 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
22874 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
22875 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
22876 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
22877 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
22878 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
22879 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
22881 static int __Pyx_modinit_global_init_code(
void) {
22882 __Pyx_RefNannyDeclarations
22883 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
22885 generic = Py_None; Py_INCREF(Py_None);
22886 strided = Py_None; Py_INCREF(Py_None);
22887 indirect = Py_None; Py_INCREF(Py_None);
22888 contiguous = Py_None; Py_INCREF(Py_None);
22889 indirect_contiguous = Py_None; Py_INCREF(Py_None);
22890 __Pyx_RefNannyFinishContext();
22894 static int __Pyx_modinit_variable_export_code(
void) {
22895 __Pyx_RefNannyDeclarations
22896 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
22898 __Pyx_RefNannyFinishContext();
22902 static int __Pyx_modinit_function_export_code(
void) {
22903 __Pyx_RefNannyDeclarations
22904 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
22906 __Pyx_RefNannyFinishContext();
22910 static int __Pyx_modinit_type_init_code(
void) {
22911 __Pyx_RefNannyDeclarations
22912 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
22914 if (PyType_Ready(&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
22915 #if PY_VERSION_HEX < 0x030800B1 22916 __pyx_type_15superluWrappers_cSparseMatrix.tp_print = 0;
22918 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_15superluWrappers_cSparseMatrix.tp_dictoffset && __pyx_type_15superluWrappers_cSparseMatrix.tp_getattro == PyObject_GenericGetAttr)) {
22919 __pyx_type_15superluWrappers_cSparseMatrix.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22921 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_cSparseMatrix_2, (PyObject *)&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
22922 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_15superluWrappers_cSparseMatrix) < 0) __PYX_ERR(0, 100, __pyx_L1_error)
22923 __pyx_ptype_15superluWrappers_cSparseMatrix = &__pyx_type_15superluWrappers_cSparseMatrix;
22924 __pyx_vtabptr_15superluWrappers_SparseFactor = &__pyx_vtable_15superluWrappers_SparseFactor;
22925 __pyx_vtable_15superluWrappers_SparseFactor._set_mat_types = (PyObject *(*)(
struct __pyx_obj_15superluWrappers_SparseFactor *))__pyx_f_15superluWrappers_12SparseFactor__set_mat_types;
22926 if (PyType_Ready(&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22927 #if PY_VERSION_HEX < 0x030800B1 22928 __pyx_type_15superluWrappers_SparseFactor.tp_print = 0;
22930 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_15superluWrappers_SparseFactor.tp_dictoffset && __pyx_type_15superluWrappers_SparseFactor.tp_getattro == PyObject_GenericGetAttr)) {
22931 __pyx_type_15superluWrappers_SparseFactor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22933 #if CYTHON_COMPILING_IN_CPYTHON 22935 PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_15superluWrappers_SparseFactor,
"__init__");
if (unlikely(!wrapper)) __PYX_ERR(0, 145, __pyx_L1_error)
22936 if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
22937 __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
22938 __pyx_wrapperbase_15superluWrappers_12SparseFactor___init__.doc = __pyx_doc_15superluWrappers_12SparseFactor___init__;
22939 ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_15superluWrappers_12SparseFactor___init__;
22943 if (__Pyx_SetVtable(__pyx_type_15superluWrappers_SparseFactor.tp_dict, __pyx_vtabptr_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22944 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SparseFactor, (PyObject *)&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22945 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_15superluWrappers_SparseFactor) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22946 __pyx_ptype_15superluWrappers_SparseFactor = &__pyx_type_15superluWrappers_SparseFactor;
22947 __pyx_vtabptr_array = &__pyx_vtable_array;
22948 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
22949 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22950 #if PY_VERSION_HEX < 0x030800B1 22951 __pyx_type___pyx_array.tp_print = 0;
22953 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22954 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22955 __pyx_array_type = &__pyx_type___pyx_array;
22956 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
22957 #if PY_VERSION_HEX < 0x030800B1 22958 __pyx_type___pyx_MemviewEnum.tp_print = 0;
22960 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
22961 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22963 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
22964 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
22965 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
22966 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
22967 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
22968 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
22969 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
22970 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
22971 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
22972 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
22973 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22974 #if PY_VERSION_HEX < 0x030800B1 22975 __pyx_type___pyx_memoryview.tp_print = 0;
22977 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
22978 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22980 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22981 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22982 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
22983 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
22984 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
22985 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
22986 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
22987 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
22988 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22989 #if PY_VERSION_HEX < 0x030800B1 22990 __pyx_type___pyx_memoryviewslice.tp_print = 0;
22992 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
22993 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22995 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22996 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22997 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
22998 __Pyx_RefNannyFinishContext();
23001 __Pyx_RefNannyFinishContext();
23005 static int __Pyx_modinit_type_import_code(
void) {
23006 __Pyx_RefNannyDeclarations
23007 PyObject *__pyx_t_1 = NULL;
23008 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
23010 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
23011 __Pyx_GOTREF(__pyx_t_1);
23012 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
23013 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
23014 sizeof(PyTypeObject),
23016 sizeof(PyHeapTypeObject),
23018 __Pyx_ImportType_CheckSize_Warn);
23019 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
23020 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23021 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
23022 __Pyx_GOTREF(__pyx_t_1);
23023 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
23024 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
23025 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
23026 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
23027 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
23028 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
23029 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
23030 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
23031 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
23032 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
23033 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23034 __Pyx_RefNannyFinishContext();
23037 __Pyx_XDECREF(__pyx_t_1);
23038 __Pyx_RefNannyFinishContext();
23042 static int __Pyx_modinit_variable_import_code(
void) {
23043 __Pyx_RefNannyDeclarations
23044 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
23046 __Pyx_RefNannyFinishContext();
23050 static int __Pyx_modinit_function_import_code(
void) {
23051 __Pyx_RefNannyDeclarations
23052 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
23054 __Pyx_RefNannyFinishContext();
23059 #if PY_MAJOR_VERSION < 3 23060 #ifdef CYTHON_NO_PYINIT_EXPORT 23061 #define __Pyx_PyMODINIT_FUNC void 23063 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC 23066 #ifdef CYTHON_NO_PYINIT_EXPORT 23067 #define __Pyx_PyMODINIT_FUNC PyObject * 23069 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC 23074 #if PY_MAJOR_VERSION < 3 23075 __Pyx_PyMODINIT_FUNC initsuperluWrappers(
void) CYTHON_SMALL_CODE;
23076 __Pyx_PyMODINIT_FUNC initsuperluWrappers(
void)
23078 __Pyx_PyMODINIT_FUNC PyInit_superluWrappers(
void) CYTHON_SMALL_CODE;
23079 __Pyx_PyMODINIT_FUNC PyInit_superluWrappers(
void)
23080 #if CYTHON_PEP489_MULTI_PHASE_INIT 23082 return PyModuleDef_Init(&__pyx_moduledef);
23084 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
23085 #if PY_VERSION_HEX >= 0x030700A1 23086 static PY_INT64_T main_interpreter_id = -1;
23087 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
23088 if (main_interpreter_id == -1) {
23089 main_interpreter_id = current_id;
23090 return (unlikely(current_id == -1)) ? -1 : 0;
23091 }
else if (unlikely(main_interpreter_id != current_id))
23093 static PyInterpreterState *main_interpreter = NULL;
23094 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
23095 if (!main_interpreter) {
23096 main_interpreter = current_interpreter;
23097 }
else if (unlikely(main_interpreter != current_interpreter))
23102 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
23107 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
23108 PyObject *value = PyObject_GetAttrString(spec, from_name);
23110 if (likely(value)) {
23111 if (allow_none || value != Py_None) {
23112 result = PyDict_SetItemString(moddict, to_name, value);
23115 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
23122 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
23123 PyObject *module = NULL, *moddict, *modname;
23124 if (__Pyx_check_single_interpreter())
23127 return __Pyx_NewRef(__pyx_m);
23128 modname = PyObject_GetAttrString(spec,
"name");
23129 if (unlikely(!modname))
goto bad;
23130 module = PyModule_NewObject(modname);
23131 Py_DECREF(modname);
23132 if (unlikely(!module))
goto bad;
23133 moddict = PyModule_GetDict(module);
23134 if (unlikely(!moddict))
goto bad;
23135 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
23136 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
23137 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
23138 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
23141 Py_XDECREF(module);
23146 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_superluWrappers(PyObject *__pyx_pyinit_module)
23150 PyObject *__pyx_t_1 = NULL;
23151 PyObject *__pyx_t_2 = NULL;
23152 PyObject *__pyx_t_3 = NULL;
23153 static PyThread_type_lock __pyx_t_4[8];
23154 __Pyx_RefNannyDeclarations
23155 #if CYTHON_PEP489_MULTI_PHASE_INIT 23157 if (__pyx_m == __pyx_pyinit_module)
return 0;
23158 PyErr_SetString(PyExc_RuntimeError,
"Module 'superluWrappers' has already been imported. Re-initialisation is not supported.");
23161 #elif PY_MAJOR_VERSION >= 3 23162 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
23164 #if CYTHON_REFNANNY 23165 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
23166 if (!__Pyx_RefNanny) {
23168 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
23169 if (!__Pyx_RefNanny)
23170 Py_FatalError(
"failed to import 'refnanny' module");
23173 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_superluWrappers(void)", 0);
23174 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23175 #ifdef __Pxy_PyFrame_Initialize_Offsets 23176 __Pxy_PyFrame_Initialize_Offsets();
23178 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
23179 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
23180 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
23181 #ifdef __Pyx_CyFunction_USED 23182 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23184 #ifdef __Pyx_FusedFunction_USED 23185 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23187 #ifdef __Pyx_Coroutine_USED 23188 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23190 #ifdef __Pyx_Generator_USED 23191 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23193 #ifdef __Pyx_AsyncGen_USED 23194 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23196 #ifdef __Pyx_StopAsyncIteration_USED 23197 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23201 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS 23203 PyEval_InitThreads();
23207 #if CYTHON_PEP489_MULTI_PHASE_INIT 23208 __pyx_m = __pyx_pyinit_module;
23209 Py_INCREF(__pyx_m);
23211 #if PY_MAJOR_VERSION < 3 23212 __pyx_m = Py_InitModule4(
"superluWrappers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23214 __pyx_m = PyModule_Create(&__pyx_moduledef);
23216 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23218 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23219 Py_INCREF(__pyx_d);
23220 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23221 Py_INCREF(__pyx_b);
23222 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
23223 Py_INCREF(__pyx_cython_runtime);
23224 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23226 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23227 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 23228 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23230 if (__pyx_module_is_main_superluWrappers) {
23231 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23233 #if PY_MAJOR_VERSION >= 3 23235 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23236 if (!PyDict_GetItemString(modules,
"superluWrappers")) {
23237 if (unlikely(PyDict_SetItemString(modules,
"superluWrappers", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23242 if (__Pyx_InitCachedBuiltins() < 0)
goto __pyx_L1_error;
23244 if (__Pyx_InitCachedConstants() < 0)
goto __pyx_L1_error;
23246 (void)__Pyx_modinit_global_init_code();
23247 (void)__Pyx_modinit_variable_export_code();
23248 (void)__Pyx_modinit_function_export_code();
23249 if (unlikely(__Pyx_modinit_type_init_code() != 0))
goto __pyx_L1_error;
23250 if (unlikely(__Pyx_modinit_type_import_code() != 0))
goto __pyx_L1_error;
23251 (void)__Pyx_modinit_variable_import_code();
23252 (void)__Pyx_modinit_function_import_code();
23254 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) 23255 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23265 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
23266 __Pyx_GOTREF(__pyx_t_1);
23267 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
23268 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23277 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__31);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
23278 __Pyx_GOTREF(__pyx_t_1);
23279 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__31, __pyx_n_s_SparseMatrix, __pyx_n_s_SparseMatrix, (PyObject *) NULL, __pyx_n_s_superluWrappers, (PyObject *) NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
23280 __Pyx_GOTREF(__pyx_t_2);
23289 __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_15superluWrappers_12SparseMatrix_1__init__, 0, __pyx_n_s_SparseMatrix___init, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__33));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
23290 __Pyx_GOTREF(__pyx_t_3);
23291 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
23292 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23301 __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_15superluWrappers_12SparseMatrix_3matvec, 0, __pyx_n_s_SparseMatrix_matvec, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__35));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
23302 __Pyx_GOTREF(__pyx_t_3);
23303 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_matvec, __pyx_t_3) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
23304 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23313 __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_15superluWrappers_12SparseMatrix_5fwrite, 0, __pyx_n_s_SparseMatrix_fwrite, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__37));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
23314 __Pyx_GOTREF(__pyx_t_3);
23315 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_fwrite, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
23316 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23325 __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_15superluWrappers_12SparseMatrix_7getCSRrepresentation, 0, __pyx_n_s_SparseMatrix_getCSRrepresentatio, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__39));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
23326 __Pyx_GOTREF(__pyx_t_3);
23327 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_getCSRrepresentation, __pyx_t_3) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
23328 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23337 __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_15superluWrappers_12SparseMatrix_9getSubMatCSRrepresentation, 0, __pyx_n_s_SparseMatrix_getSubMatCSRreprese, NULL, __pyx_n_s_superluWrappers, __pyx_d, ((PyObject *)__pyx_codeobj__41));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
23338 __Pyx_GOTREF(__pyx_t_3);
23339 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_getSubMatCSRrepresentation, __pyx_t_3) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
23340 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23349 __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_SparseMatrix, __pyx_tuple__31, __pyx_t_2, NULL, 0, 1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
23350 __Pyx_GOTREF(__pyx_t_3);
23351 if (PyDict_SetItem(__pyx_d, __pyx_n_s_SparseMatrix, __pyx_t_3) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
23352 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23353 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23354 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23363 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15superluWrappers_1sparseFactorPrepare, NULL, __pyx_n_s_superluWrappers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
23364 __Pyx_GOTREF(__pyx_t_1);
23365 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparseFactorPrepare, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
23366 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23375 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15superluWrappers_3sparseFactorSolve, NULL, __pyx_n_s_superluWrappers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
23376 __Pyx_GOTREF(__pyx_t_1);
23377 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sparseFactorSolve, __pyx_t_1) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
23378 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23385 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23386 __Pyx_GOTREF(__pyx_t_1);
23387 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23388 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23397 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
23398 __Pyx_GOTREF(__pyx_t_1);
23399 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
23400 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23401 PyType_Modified(__pyx_array_type);
23410 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__46, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
23411 __Pyx_GOTREF(__pyx_t_1);
23412 __Pyx_XGOTREF(
generic);
23413 __Pyx_DECREF_SET(
generic, __pyx_t_1);
23414 __Pyx_GIVEREF(__pyx_t_1);
23424 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__47, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
23425 __Pyx_GOTREF(__pyx_t_1);
23426 __Pyx_XGOTREF(strided);
23427 __Pyx_DECREF_SET(strided, __pyx_t_1);
23428 __Pyx_GIVEREF(__pyx_t_1);
23438 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__48, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
23439 __Pyx_GOTREF(__pyx_t_1);
23440 __Pyx_XGOTREF(indirect);
23441 __Pyx_DECREF_SET(indirect, __pyx_t_1);
23442 __Pyx_GIVEREF(__pyx_t_1);
23452 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__49, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
23453 __Pyx_GOTREF(__pyx_t_1);
23454 __Pyx_XGOTREF(contiguous);
23455 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
23456 __Pyx_GIVEREF(__pyx_t_1);
23466 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__50, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
23467 __Pyx_GOTREF(__pyx_t_1);
23468 __Pyx_XGOTREF(indirect_contiguous);
23469 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
23470 __Pyx_GIVEREF(__pyx_t_1);
23480 __pyx_memoryview_thread_locks_used = 0;
23489 __pyx_t_4[0] = PyThread_allocate_lock();
23490 __pyx_t_4[1] = PyThread_allocate_lock();
23491 __pyx_t_4[2] = PyThread_allocate_lock();
23492 __pyx_t_4[3] = PyThread_allocate_lock();
23493 __pyx_t_4[4] = PyThread_allocate_lock();
23494 __pyx_t_4[5] = PyThread_allocate_lock();
23495 __pyx_t_4[6] = PyThread_allocate_lock();
23496 __pyx_t_4[7] = PyThread_allocate_lock();
23497 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
23506 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
23507 __Pyx_GOTREF(__pyx_t_1);
23508 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
23509 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23510 PyType_Modified(__pyx_memoryview_type);
23519 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __pyx_L1_error)
23520 __Pyx_GOTREF(__pyx_t_1);
23521 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
23522 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23523 PyType_Modified(__pyx_memoryviewslice_type);
23530 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
23531 __Pyx_GOTREF(__pyx_t_1);
23532 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
23533 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23547 __Pyx_XDECREF(__pyx_t_1);
23548 __Pyx_XDECREF(__pyx_t_2);
23549 __Pyx_XDECREF(__pyx_t_3);
23552 __Pyx_AddTraceback(
"init superluWrappers", __pyx_clineno, __pyx_lineno, __pyx_filename);
23555 }
else if (!PyErr_Occurred()) {
23556 PyErr_SetString(PyExc_ImportError,
"init superluWrappers");
23559 __Pyx_RefNannyFinishContext();
23560 #if CYTHON_PEP489_MULTI_PHASE_INIT 23561 return (__pyx_m != NULL) ? 0 : -1;
23562 #elif PY_MAJOR_VERSION >= 3 23571 #if CYTHON_REFNANNY 23572 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
23573 PyObject *m = NULL, *p = NULL;
23575 m = PyImport_ImportModule(modname);
23577 p = PyObject_GetAttrString(m,
"RefNannyAPI");
23579 r = PyLong_AsVoidPtr(p);
23583 return (__Pyx_RefNannyAPIStruct *)
r;
23588 #if CYTHON_USE_TYPE_SLOTS 23589 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
23590 PyTypeObject* tp = Py_TYPE(obj);
23591 if (likely(tp->tp_getattro))
23592 return tp->tp_getattro(obj, attr_name);
23593 #if PY_MAJOR_VERSION < 3 23594 if (likely(tp->tp_getattr))
23595 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
23597 return PyObject_GetAttr(obj, attr_name);
23602 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23603 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23604 if (unlikely(!result)) {
23605 PyErr_Format(PyExc_NameError,
23606 #
if PY_MAJOR_VERSION >= 3
23607 "name '%U' is not defined", name);
23609 "name '%.200s' is not defined", PyString_AS_STRING(name));
23616 static void __Pyx_RaiseArgtupleInvalid(
23617 const char* func_name,
23619 Py_ssize_t num_min,
23620 Py_ssize_t num_max,
23621 Py_ssize_t num_found)
23623 Py_ssize_t num_expected;
23624 const char *more_or_less;
23625 if (num_found < num_min) {
23626 num_expected = num_min;
23627 more_or_less =
"at least";
23629 num_expected = num_max;
23630 more_or_less =
"at most";
23633 more_or_less =
"exactly";
23635 PyErr_Format(PyExc_TypeError,
23636 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
23637 func_name, more_or_less, num_expected,
23638 (num_expected == 1) ?
"" :
"s", num_found);
23642 static void __Pyx_RaiseDoubleKeywordsError(
23643 const char* func_name,
23646 PyErr_Format(PyExc_TypeError,
23647 #
if PY_MAJOR_VERSION >= 3
23648 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23650 "%s() got multiple values for keyword argument '%s'", func_name,
23651 PyString_AsString(kw_name));
23656 static int __Pyx_ParseOptionalKeywords(
23658 PyObject **argnames[],
23660 PyObject *values[],
23661 Py_ssize_t num_pos_args,
23662 const char* function_name)
23664 PyObject *key = 0, *value = 0;
23665 Py_ssize_t
pos = 0;
23667 PyObject*** first_kw_arg = argnames + num_pos_args;
23668 while (PyDict_Next(kwds, &pos, &key, &value)) {
23669 name = first_kw_arg;
23670 while (*name && (**name != key)) name++;
23672 values[name-argnames] = value;
23675 name = first_kw_arg;
23676 #if PY_MAJOR_VERSION < 3 23677 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
23679 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23680 && _PyString_Eq(**name, key)) {
23681 values[name-argnames] = value;
23686 if (*name)
continue;
23688 PyObject*** argname = argnames;
23689 while (argname != first_kw_arg) {
23690 if ((**argname == key) || (
23691 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23692 && _PyString_Eq(**argname, key))) {
23693 goto arg_passed_twice;
23700 if (likely(PyUnicode_Check(key))) {
23702 int cmp = (**name == key) ? 0 :
23703 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23704 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
23706 PyUnicode_Compare(**name, key);
23707 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23709 values[name-argnames] = value;
23714 if (*name)
continue;
23716 PyObject*** argname = argnames;
23717 while (argname != first_kw_arg) {
23718 int cmp = (**argname == key) ? 0 :
23719 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23720 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
23722 PyUnicode_Compare(**argname, key);
23723 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23724 if (cmp == 0)
goto arg_passed_twice;
23729 goto invalid_keyword_type;
23731 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
23733 goto invalid_keyword;
23738 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23740 invalid_keyword_type:
23741 PyErr_Format(PyExc_TypeError,
23742 "%.200s() keywords must be strings", function_name);
23745 PyErr_Format(PyExc_TypeError,
23746 #
if PY_MAJOR_VERSION < 3
23747 "%.200s() got an unexpected keyword argument '%.200s'",
23748 function_name, PyString_AsString(key));
23750 "%s() got an unexpected keyword argument '%U'",
23751 function_name, key);
23758 #if CYTHON_USE_TYPE_SLOTS 23759 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
23760 PyTypeObject* tp = Py_TYPE(obj);
23761 if (likely(tp->tp_setattro))
23762 return tp->tp_setattro(obj, attr_name, value);
23763 #if PY_MAJOR_VERSION < 3 23764 if (likely(tp->tp_setattr))
23765 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
23767 return PyObject_SetAttr(obj, attr_name, value);
23772 #if CYTHON_COMPILING_IN_CPYTHON 23773 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
23775 ternaryfunc call = func->ob_type->tp_call;
23776 if (unlikely(!call))
23777 return PyObject_Call(func, arg, kw);
23778 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23780 result = (*call)(func, arg, kw);
23781 Py_LeaveRecursiveCall();
23782 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23785 "NULL result without error in PyObject_Call");
23792 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23793 if (unlikely(!type)) {
23794 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23797 if (likely(__Pyx_TypeCheck(obj, type)))
23799 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
23800 Py_TYPE(obj)->tp_name, type->tp_name);
23806 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
23808 __Pyx_memviewslice *memviewslice,
23809 int memview_is_new_reference)
23811 __Pyx_RefNannyDeclarations
23813 Py_buffer *buf = &memview->view;
23814 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
23815 if (memviewslice->memview || memviewslice->data) {
23816 PyErr_SetString(PyExc_ValueError,
23817 "memviewslice is already initialized!");
23820 if (buf->strides) {
23821 for (i = 0; i < ndim; i++) {
23822 memviewslice->strides[i] = buf->strides[i];
23825 Py_ssize_t stride = buf->itemsize;
23826 for (i = ndim - 1; i >= 0; i--) {
23827 memviewslice->strides[i] = stride;
23828 stride *= buf->shape[i];
23831 for (i = 0; i < ndim; i++) {
23832 memviewslice->shape[i] = buf->shape[i];
23833 if (buf->suboffsets) {
23834 memviewslice->suboffsets[i] = buf->suboffsets[i];
23836 memviewslice->suboffsets[i] = -1;
23839 memviewslice->memview = memview;
23840 memviewslice->data = (
char *)buf->buf;
23841 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
23842 Py_INCREF(memview);
23847 memviewslice->memview = 0;
23848 memviewslice->data = 0;
23851 __Pyx_RefNannyFinishContext();
23854 #ifndef Py_NO_RETURN 23855 #define Py_NO_RETURN 23857 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
23860 #ifdef HAVE_STDARG_PROTOTYPES 23861 va_start(vargs, fmt);
23865 vsnprintf(msg, 200, fmt, vargs);
23867 Py_FatalError(msg);
23869 static CYTHON_INLINE
int 23870 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23871 PyThread_type_lock lock)
23874 PyThread_acquire_lock(lock, 1);
23875 result = (*acquisition_count)++;
23876 PyThread_release_lock(lock);
23879 static CYTHON_INLINE
int 23880 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
23881 PyThread_type_lock lock)
23884 PyThread_acquire_lock(lock, 1);
23885 result = (*acquisition_count)--;
23886 PyThread_release_lock(lock);
23889 static CYTHON_INLINE
void 23890 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
23893 struct __pyx_memoryview_obj *memview = memslice->memview;
23894 if (!memview || (PyObject *) memview == Py_None)
23896 if (__pyx_get_slice_count(memview) < 0)
23897 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
23898 __pyx_get_slice_count(memview), lineno);
23899 first_time = __pyx_add_acquisition_count(memview) == 0;
23902 Py_INCREF((PyObject *) memview);
23904 PyGILState_STATE _gilstate = PyGILState_Ensure();
23905 Py_INCREF((PyObject *) memview);
23906 PyGILState_Release(_gilstate);
23910 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
23911 int have_gil,
int lineno) {
23913 struct __pyx_memoryview_obj *memview = memslice->memview;
23916 }
else if ((PyObject *) memview == Py_None) {
23917 memslice->memview = NULL;
23920 if (__pyx_get_slice_count(memview) <= 0)
23921 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
23922 __pyx_get_slice_count(memview), lineno);
23923 last_time = __pyx_sub_acquisition_count(memview) == 1;
23924 memslice->data = NULL;
23927 Py_CLEAR(memslice->memview);
23929 PyGILState_STATE _gilstate = PyGILState_Ensure();
23930 Py_CLEAR(memslice->memview);
23931 PyGILState_Release(_gilstate);
23934 memslice->memview = NULL;
23939 #if CYTHON_FAST_PYCALL 23940 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23941 PyObject *globals) {
23943 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23944 PyObject **fastlocals;
23947 assert(globals != NULL);
23952 assert(tstate != NULL);
23953 f = PyFrame_New(tstate, co, globals, NULL);
23957 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
23958 for (i = 0; i < na; i++) {
23960 fastlocals[i] = *args++;
23962 result = PyEval_EvalFrameEx(f,0);
23963 ++tstate->recursion_depth;
23965 --tstate->recursion_depth;
23968 #if 1 || PY_VERSION_HEX < 0x030600B1 23969 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23970 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23971 PyObject *globals = PyFunction_GET_GLOBALS(func);
23972 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23974 #if PY_MAJOR_VERSION >= 3 23977 PyObject *kwtuple, **k;
23982 assert(kwargs == NULL || PyDict_Check(kwargs));
23983 nk = kwargs ? PyDict_Size(kwargs) : 0;
23984 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
23988 #
if PY_MAJOR_VERSION >= 3
23989 co->co_kwonlyargcount == 0 &&
23991 likely(kwargs == NULL || nk == 0) &&
23992 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23993 if (argdefs == NULL && co->co_argcount == nargs) {
23994 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23997 else if (nargs == 0 && argdefs != NULL
23998 && co->co_argcount == Py_SIZE(argdefs)) {
24001 args = &PyTuple_GET_ITEM(argdefs, 0);
24002 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
24006 if (kwargs != NULL) {
24008 kwtuple = PyTuple_New(2 * nk);
24009 if (kwtuple == NULL) {
24013 k = &PyTuple_GET_ITEM(kwtuple, 0);
24015 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
24026 closure = PyFunction_GET_CLOSURE(func);
24027 #if PY_MAJOR_VERSION >= 3 24028 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
24030 if (argdefs != NULL) {
24031 d = &PyTuple_GET_ITEM(argdefs, 0);
24032 nd = Py_SIZE(argdefs);
24038 #if PY_MAJOR_VERSION >= 3 24039 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
24042 d, (
int)nd, kwdefs, closure);
24044 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
24047 d, (
int)nd, closure);
24049 Py_XDECREF(kwtuple);
24051 Py_LeaveRecursiveCall();
24058 #if CYTHON_COMPILING_IN_CPYTHON 24059 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
24060 PyObject *
self, *result;
24062 cfunc = PyCFunction_GET_FUNCTION(func);
24063 self = PyCFunction_GET_SELF(func);
24064 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
24066 result = cfunc(
self, arg);
24067 Py_LeaveRecursiveCall();
24068 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24071 "NULL result without error in PyObject_Call");
24078 #if CYTHON_COMPILING_IN_CPYTHON 24079 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
24080 #if CYTHON_FAST_PYCALL 24081 if (PyFunction_Check(func)) {
24082 return __Pyx_PyFunction_FastCall(func, NULL, 0);
24085 #ifdef __Pyx_CyFunction_USED 24086 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
24088 if (likely(PyCFunction_Check(func)))
24091 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
24092 return __Pyx_PyObject_CallMethO(func, NULL);
24095 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
24100 #if CYTHON_FAST_PYCCALL 24101 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
24102 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
24103 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
24104 PyObject *
self = PyCFunction_GET_SELF(func);
24105 int flags = PyCFunction_GET_FLAGS(func);
24106 assert(PyCFunction_Check(func));
24107 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
24108 assert(nargs >= 0);
24109 assert(nargs == 0 || args != NULL);
24113 assert(!PyErr_Occurred());
24114 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
24115 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
24117 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
24123 #if CYTHON_COMPILING_IN_CPYTHON 24124 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24126 PyObject *args = PyTuple_New(1);
24127 if (unlikely(!args))
return NULL;
24129 PyTuple_SET_ITEM(args, 0, arg);
24130 result = __Pyx_PyObject_Call(func, args, NULL);
24134 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24135 #if CYTHON_FAST_PYCALL 24136 if (PyFunction_Check(func)) {
24137 return __Pyx_PyFunction_FastCall(func, &arg, 1);
24140 if (likely(PyCFunction_Check(func))) {
24141 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
24142 return __Pyx_PyObject_CallMethO(func, arg);
24143 #if CYTHON_FAST_PYCCALL 24144 }
else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
24145 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
24149 return __Pyx__PyObject_CallOneArg(func, arg);
24152 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24154 PyObject *args = PyTuple_Pack(1, arg);
24155 if (unlikely(!args))
return NULL;
24156 result = __Pyx_PyObject_Call(func, args, NULL);
24163 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24165 if (!j)
return NULL;
24166 r = PyObject_GetItem(o, j);
24170 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24171 CYTHON_NCP_UNUSED
int wraparound,
24172 CYTHON_NCP_UNUSED
int boundscheck) {
24173 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 24174 Py_ssize_t wrapped_i = i;
24175 if (wraparound & unlikely(i < 0)) {
24176 wrapped_i += PyList_GET_SIZE(o);
24178 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
24179 PyObject *
r = PyList_GET_ITEM(o, wrapped_i);
24183 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24185 return PySequence_GetItem(o, i);
24188 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24189 CYTHON_NCP_UNUSED
int wraparound,
24190 CYTHON_NCP_UNUSED
int boundscheck) {
24191 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 24192 Py_ssize_t wrapped_i = i;
24193 if (wraparound & unlikely(i < 0)) {
24194 wrapped_i += PyTuple_GET_SIZE(o);
24196 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
24197 PyObject *
r = PyTuple_GET_ITEM(o, wrapped_i);
24201 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24203 return PySequence_GetItem(o, i);
24206 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
24207 CYTHON_NCP_UNUSED
int wraparound,
24208 CYTHON_NCP_UNUSED
int boundscheck) {
24209 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS 24210 if (is_list || PyList_CheckExact(o)) {
24211 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24212 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
24213 PyObject *
r = PyList_GET_ITEM(o, n);
24218 else if (PyTuple_CheckExact(o)) {
24219 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24220 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
24221 PyObject *
r = PyTuple_GET_ITEM(o, n);
24226 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
24227 if (likely(m && m->sq_item)) {
24228 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
24229 Py_ssize_t l = m->sq_length(o);
24230 if (likely(l >= 0)) {
24233 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24238 return m->sq_item(o, i);
24242 if (is_list || PySequence_Check(o)) {
24243 return PySequence_GetItem(o, i);
24246 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24250 #if CYTHON_USE_TYPE_SLOTS 24251 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
24253 Py_ssize_t key_value;
24254 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
24255 if (unlikely(!(m && m->sq_item))) {
24256 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
24259 key_value = __Pyx_PyIndex_AsSsize_t(index);
24260 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24261 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24263 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24265 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
24269 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
24270 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
24271 if (likely(m && m->mp_subscript)) {
24272 return m->mp_subscript(obj, key);
24274 return __Pyx_PyObject_GetIndex(obj, key);
24279 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
24280 PyObject *args, *result = NULL;
24281 #if CYTHON_FAST_PYCALL 24282 if (PyFunction_Check(
function)) {
24283 PyObject *args[2] = {arg1, arg2};
24284 return __Pyx_PyFunction_FastCall(
function, args, 2);
24287 #if CYTHON_FAST_PYCCALL 24288 if (__Pyx_PyFastCFunction_Check(
function)) {
24289 PyObject *args[2] = {arg1, arg2};
24290 return __Pyx_PyCFunction_FastCall(
function, args, 2);
24293 args = PyTuple_New(2);
24294 if (unlikely(!args))
goto done;
24296 PyTuple_SET_ITEM(args, 0, arg1);
24298 PyTuple_SET_ITEM(args, 1, arg2);
24299 Py_INCREF(
function);
24300 result = __Pyx_PyObject_Call(
function, args, NULL);
24302 Py_DECREF(
function);
24308 #if !CYTHON_COMPILING_IN_PYPY 24309 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
24311 (void)zerodivision_check;
24312 #if PY_MAJOR_VERSION < 3 24313 if (likely(PyInt_CheckExact(op1))) {
24314 const long b = intval;
24316 long a = PyInt_AS_LONG(op1);
24317 x = (long)((
unsigned long)a + b);
24318 if (likely((x^a) >= 0 || (x^b) >= 0))
24319 return PyInt_FromLong(x);
24320 return PyLong_Type.tp_as_number->nb_add(op1, op2);
24323 #if CYTHON_USE_PYLONG_INTERNALS 24324 if (likely(PyLong_CheckExact(op1))) {
24325 const long b = intval;
24327 #ifdef HAVE_LONG_LONG 24328 const PY_LONG_LONG llb = intval;
24329 PY_LONG_LONG lla, llx;
24331 const digit* digits = ((PyLongObject*)op1)->ob_digit;
24332 const Py_ssize_t size = Py_SIZE(op1);
24333 if (likely(__Pyx_sst_abs(size) <= 1)) {
24334 a = likely(size) ? digits[0] : 0;
24335 if (size == -1) a = -a;
24339 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
24340 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24342 #ifdef HAVE_LONG_LONG 24343 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24344 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24348 CYTHON_FALLTHROUGH;
24350 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
24351 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24353 #ifdef HAVE_LONG_LONG 24354 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24355 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24359 CYTHON_FALLTHROUGH;
24361 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
24362 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24364 #ifdef HAVE_LONG_LONG 24365 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24366 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24370 CYTHON_FALLTHROUGH;
24372 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
24373 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24375 #ifdef HAVE_LONG_LONG 24376 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24377 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24381 CYTHON_FALLTHROUGH;
24383 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
24384 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24386 #ifdef HAVE_LONG_LONG 24387 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24388 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24392 CYTHON_FALLTHROUGH;
24394 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
24395 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24397 #ifdef HAVE_LONG_LONG 24398 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24399 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24403 CYTHON_FALLTHROUGH;
24404 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
24408 return PyLong_FromLong(x);
24409 #ifdef HAVE_LONG_LONG 24412 return PyLong_FromLongLong(llx);
24418 if (PyFloat_CheckExact(op1)) {
24419 const long b = intval;
24420 double a = PyFloat_AS_DOUBLE(op1);
24422 PyFPE_START_PROTECT(
"add",
return NULL)
24423 result = ((double)a) + (double)b;
24424 PyFPE_END_PROTECT(result)
24425 return PyFloat_FromDouble(result);
24427 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24432 #if CYTHON_USE_EXC_INFO_STACK 24433 static _PyErr_StackItem *
24434 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
24436 _PyErr_StackItem *exc_info = tstate->exc_info;
24437 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
24438 exc_info->previous_item != NULL)
24440 exc_info = exc_info->previous_item;
24447 #if CYTHON_FAST_THREAD_STATE 24448 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24449 #if CYTHON_USE_EXC_INFO_STACK 24450 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24451 *type = exc_info->exc_type;
24452 *value = exc_info->exc_value;
24453 *tb = exc_info->exc_traceback;
24455 *type = tstate->exc_type;
24456 *value = tstate->exc_value;
24457 *tb = tstate->exc_traceback;
24460 Py_XINCREF(*value);
24463 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24464 PyObject *tmp_type, *tmp_value, *tmp_tb;
24465 #if CYTHON_USE_EXC_INFO_STACK 24466 _PyErr_StackItem *exc_info = tstate->exc_info;
24467 tmp_type = exc_info->exc_type;
24468 tmp_value = exc_info->exc_value;
24469 tmp_tb = exc_info->exc_traceback;
24470 exc_info->exc_type = type;
24471 exc_info->exc_value = value;
24472 exc_info->exc_traceback = tb;
24474 tmp_type = tstate->exc_type;
24475 tmp_value = tstate->exc_value;
24476 tmp_tb = tstate->exc_traceback;
24477 tstate->exc_type = type;
24478 tstate->exc_value = value;
24479 tstate->exc_traceback = tb;
24481 Py_XDECREF(tmp_type);
24482 Py_XDECREF(tmp_value);
24483 Py_XDECREF(tmp_tb);
24488 #if CYTHON_FAST_THREAD_STATE 24489 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
24491 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
24494 PyObject *local_type, *local_value, *local_tb;
24495 #if CYTHON_FAST_THREAD_STATE 24496 PyObject *tmp_type, *tmp_value, *tmp_tb;
24497 local_type = tstate->curexc_type;
24498 local_value = tstate->curexc_value;
24499 local_tb = tstate->curexc_traceback;
24500 tstate->curexc_type = 0;
24501 tstate->curexc_value = 0;
24502 tstate->curexc_traceback = 0;
24504 PyErr_Fetch(&local_type, &local_value, &local_tb);
24506 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
24507 #if CYTHON_FAST_THREAD_STATE 24508 if (unlikely(tstate->curexc_type))
24510 if (unlikely(PyErr_Occurred()))
24513 #if PY_MAJOR_VERSION >= 3 24515 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
24519 Py_XINCREF(local_tb);
24520 Py_XINCREF(local_type);
24521 Py_XINCREF(local_value);
24522 *type = local_type;
24523 *value = local_value;
24525 #if CYTHON_FAST_THREAD_STATE 24526 #if CYTHON_USE_EXC_INFO_STACK 24528 _PyErr_StackItem *exc_info = tstate->exc_info;
24529 tmp_type = exc_info->exc_type;
24530 tmp_value = exc_info->exc_value;
24531 tmp_tb = exc_info->exc_traceback;
24532 exc_info->exc_type = local_type;
24533 exc_info->exc_value = local_value;
24534 exc_info->exc_traceback = local_tb;
24537 tmp_type = tstate->exc_type;
24538 tmp_value = tstate->exc_value;
24539 tmp_tb = tstate->exc_traceback;
24540 tstate->exc_type = local_type;
24541 tstate->exc_value = local_value;
24542 tstate->exc_traceback = local_tb;
24544 Py_XDECREF(tmp_type);
24545 Py_XDECREF(tmp_value);
24546 Py_XDECREF(tmp_tb);
24548 PyErr_SetExcInfo(local_type, local_value, local_tb);
24555 Py_XDECREF(local_type);
24556 Py_XDECREF(local_value);
24557 Py_XDECREF(local_tb);
24562 #if CYTHON_FAST_THREAD_STATE 24563 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24564 PyObject *tmp_type, *tmp_value, *tmp_tb;
24565 tmp_type = tstate->curexc_type;
24566 tmp_value = tstate->curexc_value;
24567 tmp_tb = tstate->curexc_traceback;
24568 tstate->curexc_type = type;
24569 tstate->curexc_value = value;
24570 tstate->curexc_traceback = tb;
24571 Py_XDECREF(tmp_type);
24572 Py_XDECREF(tmp_value);
24573 Py_XDECREF(tmp_tb);
24575 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24576 *type = tstate->curexc_type;
24577 *value = tstate->curexc_value;
24578 *tb = tstate->curexc_traceback;
24579 tstate->curexc_type = 0;
24580 tstate->curexc_value = 0;
24581 tstate->curexc_traceback = 0;
24586 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
24587 Py_ssize_t cstart, Py_ssize_t cstop,
24588 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
24589 int has_cstart,
int has_cstop, CYTHON_UNUSED
int wraparound) {
24590 #if CYTHON_USE_TYPE_SLOTS 24591 PyMappingMethods* mp;
24592 #if PY_MAJOR_VERSION < 3 24593 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
24594 if (likely(ms && ms->sq_slice)) {
24596 if (_py_start && (*_py_start != Py_None)) {
24597 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
24598 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
24603 if (_py_stop && (*_py_stop != Py_None)) {
24604 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
24605 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
24607 cstop = PY_SSIZE_T_MAX;
24609 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
24610 Py_ssize_t l = ms->sq_length(obj);
24611 if (likely(l >= 0)) {
24614 if (cstop < 0) cstop = 0;
24618 if (cstart < 0) cstart = 0;
24621 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24626 return ms->sq_slice(obj, cstart, cstop);
24629 mp = Py_TYPE(obj)->tp_as_mapping;
24630 if (likely(mp && mp->mp_subscript))
24634 PyObject *py_slice, *py_start, *py_stop;
24636 py_slice = *_py_slice;
24638 PyObject* owned_start = NULL;
24639 PyObject* owned_stop = NULL;
24641 py_start = *_py_start;
24644 owned_start = py_start = PyInt_FromSsize_t(cstart);
24645 if (unlikely(!py_start))
goto bad;
24647 py_start = Py_None;
24650 py_stop = *_py_stop;
24653 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
24654 if (unlikely(!py_stop)) {
24655 Py_XDECREF(owned_start);
24661 py_slice = PySlice_New(py_start, py_stop, Py_None);
24662 Py_XDECREF(owned_start);
24663 Py_XDECREF(owned_stop);
24664 if (unlikely(!py_slice))
goto bad;
24666 #if CYTHON_USE_TYPE_SLOTS 24667 result = mp->mp_subscript(obj, py_slice);
24669 result = PyObject_GetItem(obj, py_slice);
24672 Py_DECREF(py_slice);
24676 PyErr_Format(PyExc_TypeError,
24677 "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
24683 #if PY_MAJOR_VERSION < 3 24684 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
24685 CYTHON_UNUSED PyObject *cause) {
24686 __Pyx_PyThreadState_declare
24688 if (!value || value == Py_None)
24692 if (!tb || tb == Py_None)
24696 if (!PyTraceBack_Check(tb)) {
24697 PyErr_SetString(PyExc_TypeError,
24698 "raise: arg 3 must be a traceback or None");
24702 if (PyType_Check(type)) {
24703 #if CYTHON_COMPILING_IN_PYPY 24705 Py_INCREF(Py_None);
24709 PyErr_NormalizeException(&type, &value, &tb);
24712 PyErr_SetString(PyExc_TypeError,
24713 "instance exception may not have a separate value");
24717 type = (PyObject*) Py_TYPE(type);
24719 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
24720 PyErr_SetString(PyExc_TypeError,
24721 "raise: exception class must be a subclass of BaseException");
24725 __Pyx_PyThreadState_assign
24726 __Pyx_ErrRestore(type, value, tb);
24735 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
24736 PyObject* owned_instance = NULL;
24737 if (tb == Py_None) {
24739 }
else if (tb && !PyTraceBack_Check(tb)) {
24740 PyErr_SetString(PyExc_TypeError,
24741 "raise: arg 3 must be a traceback or None");
24744 if (value == Py_None)
24746 if (PyExceptionInstance_Check(type)) {
24748 PyErr_SetString(PyExc_TypeError,
24749 "instance exception may not have a separate value");
24753 type = (PyObject*) Py_TYPE(value);
24754 }
else if (PyExceptionClass_Check(type)) {
24755 PyObject *instance_class = NULL;
24756 if (value && PyExceptionInstance_Check(value)) {
24757 instance_class = (PyObject*) Py_TYPE(value);
24758 if (instance_class != type) {
24759 int is_subclass = PyObject_IsSubclass(instance_class, type);
24760 if (!is_subclass) {
24761 instance_class = NULL;
24762 }
else if (unlikely(is_subclass == -1)) {
24765 type = instance_class;
24769 if (!instance_class) {
24772 args = PyTuple_New(0);
24773 else if (PyTuple_Check(value)) {
24777 args = PyTuple_Pack(1, value);
24780 owned_instance = PyObject_Call(type, args, NULL);
24782 if (!owned_instance)
24784 value = owned_instance;
24785 if (!PyExceptionInstance_Check(value)) {
24786 PyErr_Format(PyExc_TypeError,
24787 "calling %R should have returned an instance of " 24788 "BaseException, not %R",
24789 type, Py_TYPE(value));
24794 PyErr_SetString(PyExc_TypeError,
24795 "raise: exception class must be a subclass of BaseException");
24799 PyObject *fixed_cause;
24800 if (cause == Py_None) {
24801 fixed_cause = NULL;
24802 }
else if (PyExceptionClass_Check(cause)) {
24803 fixed_cause = PyObject_CallObject(cause, NULL);
24804 if (fixed_cause == NULL)
24806 }
else if (PyExceptionInstance_Check(cause)) {
24807 fixed_cause = cause;
24808 Py_INCREF(fixed_cause);
24810 PyErr_SetString(PyExc_TypeError,
24811 "exception causes must derive from " 24815 PyException_SetCause(value, fixed_cause);
24817 PyErr_SetObject(type, value);
24819 #if CYTHON_COMPILING_IN_PYPY 24820 PyObject *tmp_type, *tmp_value, *tmp_tb;
24821 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
24823 PyErr_Restore(tmp_type, tmp_value, tb);
24824 Py_XDECREF(tmp_tb);
24826 PyThreadState *tstate = __Pyx_PyThreadState_Current;
24827 PyObject* tmp_tb = tstate->curexc_traceback;
24828 if (tb != tmp_tb) {
24830 tstate->curexc_traceback = tb;
24831 Py_XDECREF(tmp_tb);
24836 Py_XDECREF(owned_instance);
24842 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
24843 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
24844 int full_traceback, CYTHON_UNUSED
int nogil) {
24845 PyObject *old_exc, *old_val, *old_tb;
24847 __Pyx_PyThreadState_declare
24849 PyGILState_STATE state;
24851 state = PyGILState_Ensure();
24853 else state = (PyGILState_STATE)-1;
24856 __Pyx_PyThreadState_assign
24857 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
24858 if (full_traceback) {
24859 Py_XINCREF(old_exc);
24860 Py_XINCREF(old_val);
24861 Py_XINCREF(old_tb);
24862 __Pyx_ErrRestore(old_exc, old_val, old_tb);
24865 #if PY_MAJOR_VERSION < 3 24866 ctx = PyString_FromString(name);
24868 ctx = PyUnicode_FromString(name);
24870 __Pyx_ErrRestore(old_exc, old_val, old_tb);
24872 PyErr_WriteUnraisable(Py_None);
24874 PyErr_WriteUnraisable(ctx);
24879 PyGILState_Release(state);
24884 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY 24885 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
24887 value = PyDict_GetItemWithError(d, key);
24888 if (unlikely(!value)) {
24889 if (!PyErr_Occurred()) {
24890 if (unlikely(PyTuple_Check(key))) {
24891 PyObject* args = PyTuple_Pack(1, key);
24892 if (likely(args)) {
24893 PyErr_SetObject(PyExc_KeyError, args);
24897 PyErr_SetObject(PyExc_KeyError, key);
24908 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24909 PyErr_Format(PyExc_ValueError,
24910 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
24914 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24915 PyErr_Format(PyExc_ValueError,
24916 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
24917 index, (index == 1) ?
"" :
"s");
24921 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
24922 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
24926 #if CYTHON_FAST_THREAD_STATE 24927 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24929 n = PyTuple_GET_SIZE(tuple);
24930 #if PY_MAJOR_VERSION >= 3 24931 for (i=0; i<
n; i++) {
24932 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24935 for (i=0; i<
n; i++) {
24936 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
24940 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
24941 PyObject *exc_type = tstate->curexc_type;
24942 if (exc_type == err)
return 1;
24943 if (unlikely(!exc_type))
return 0;
24944 if (unlikely(PyTuple_Check(err)))
24945 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
24946 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
24951 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
24953 if (unlikely(!type)) {
24954 PyErr_SetString(PyExc_SystemError,
"Missing type object");
24958 #if PY_MAJOR_VERSION == 2 24959 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
24963 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
24965 PyErr_Format(PyExc_TypeError,
24966 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
24967 name, type->tp_name, Py_TYPE(obj)->tp_name);
24972 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
24973 #if CYTHON_COMPILING_IN_PYPY 24974 return PyObject_RichCompareBool(s1, s2, equals);
24977 return (equals == Py_EQ);
24978 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
24979 const char *ps1, *ps2;
24980 Py_ssize_t length = PyBytes_GET_SIZE(s1);
24981 if (length != PyBytes_GET_SIZE(s2))
24982 return (equals == Py_NE);
24983 ps1 = PyBytes_AS_STRING(s1);
24984 ps2 = PyBytes_AS_STRING(s2);
24985 if (ps1[0] != ps2[0]) {
24986 return (equals == Py_NE);
24987 }
else if (length == 1) {
24988 return (equals == Py_EQ);
24991 #if CYTHON_USE_UNICODE_INTERNALS 24992 Py_hash_t hash1, hash2;
24993 hash1 = ((PyBytesObject*)s1)->ob_shash;
24994 hash2 = ((PyBytesObject*)s2)->ob_shash;
24995 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24996 return (equals == Py_NE);
24999 result = memcmp(ps1, ps2, (
size_t)length);
25000 return (equals == Py_EQ) ? (result == 0) : (result != 0);
25002 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
25003 return (equals == Py_NE);
25004 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
25005 return (equals == Py_NE);
25008 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
25011 result = __Pyx_PyObject_IsTrue(py_result);
25012 Py_DECREF(py_result);
25019 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
25020 #if CYTHON_COMPILING_IN_PYPY 25021 return PyObject_RichCompareBool(s1, s2, equals);
25023 #if PY_MAJOR_VERSION < 3 25024 PyObject* owned_ref = NULL;
25026 int s1_is_unicode, s2_is_unicode;
25030 s1_is_unicode = PyUnicode_CheckExact(s1);
25031 s2_is_unicode = PyUnicode_CheckExact(s2);
25032 #if PY_MAJOR_VERSION < 3 25033 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
25034 owned_ref = PyUnicode_FromObject(s2);
25035 if (unlikely(!owned_ref))
25039 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
25040 owned_ref = PyUnicode_FromObject(s1);
25041 if (unlikely(!owned_ref))
25045 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
25046 return __Pyx_PyBytes_Equals(s1, s2, equals);
25049 if (s1_is_unicode & s2_is_unicode) {
25052 void *data1, *data2;
25053 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
25055 length = __Pyx_PyUnicode_GET_LENGTH(s1);
25056 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
25059 #if CYTHON_USE_UNICODE_INTERNALS 25061 Py_hash_t hash1, hash2;
25062 #if CYTHON_PEP393_ENABLED 25063 hash1 = ((PyASCIIObject*)s1)->hash;
25064 hash2 = ((PyASCIIObject*)s2)->hash;
25066 hash1 = ((PyUnicodeObject*)s1)->hash;
25067 hash2 = ((PyUnicodeObject*)s2)->hash;
25069 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
25074 kind = __Pyx_PyUnicode_KIND(s1);
25075 if (kind != __Pyx_PyUnicode_KIND(s2)) {
25078 data1 = __Pyx_PyUnicode_DATA(s1);
25079 data2 = __Pyx_PyUnicode_DATA(s2);
25080 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
25082 }
else if (length == 1) {
25085 int result = memcmp(data1, data2, (
size_t)(length * kind));
25086 #if PY_MAJOR_VERSION < 3 25087 Py_XDECREF(owned_ref);
25089 return (equals == Py_EQ) ? (result == 0) : (result != 0);
25091 }
else if ((s1 == Py_None) & s2_is_unicode) {
25093 }
else if ((s2 == Py_None) & s1_is_unicode) {
25097 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
25098 #if PY_MAJOR_VERSION < 3 25099 Py_XDECREF(owned_ref);
25103 result = __Pyx_PyObject_IsTrue(py_result);
25104 Py_DECREF(py_result);
25108 #if PY_MAJOR_VERSION < 3 25109 Py_XDECREF(owned_ref);
25111 return (equals == Py_EQ);
25113 #if PY_MAJOR_VERSION < 3 25114 Py_XDECREF(owned_ref);
25116 return (equals == Py_NE);
25121 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
25122 Py_ssize_t
q = a / b;
25123 Py_ssize_t
r = a - q*b;
25124 q -= ((r != 0) & ((r ^ b) < 0));
25129 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *
n) {
25130 #if CYTHON_USE_TYPE_SLOTS 25131 #if PY_MAJOR_VERSION >= 3 25132 if (likely(PyUnicode_Check(n)))
25134 if (likely(PyString_Check(n)))
25136 return __Pyx_PyObject_GetAttrStr(o, n);
25138 return PyObject_GetAttr(o, n);
25142 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
25143 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
25144 const char* encoding,
const char* errors,
25145 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors)) {
25147 if (unlikely((start < 0) | (stop < 0))) {
25148 size_t slen = strlen(cstring);
25149 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
25150 PyErr_SetString(PyExc_OverflowError,
25151 "c-string too long to convert to Python");
25154 length = (Py_ssize_t) slen;
25163 length = stop - start;
25164 if (unlikely(length <= 0))
25165 return PyUnicode_FromUnicode(NULL, 0);
25168 return decode_func(cstring, length, errors);
25170 return PyUnicode_Decode(cstring, length, encoding, errors);
25175 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
25176 __Pyx_PyThreadState_declare
25177 __Pyx_PyThreadState_assign
25178 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
25180 __Pyx_PyErr_Clear();
25184 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *
n, PyObject *d) {
25185 PyObject *
r = __Pyx_GetAttr(o,
n);
25186 return (likely(r)) ?
r : __Pyx_GetAttr3Default(d);
25190 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS 25191 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
25192 PyObject *dict = Py_TYPE(obj)->tp_dict;
25193 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
25195 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
25196 PyObject **dictptr = NULL;
25197 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
25199 #if CYTHON_COMPILING_IN_CPYTHON 25200 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
25202 dictptr = _PyObject_GetDictPtr(obj);
25205 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
25207 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
25208 PyObject *dict = Py_TYPE(obj)->tp_dict;
25209 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
25211 return obj_dict_version == __Pyx_get_object_dict_version(obj);
25216 #if CYTHON_USE_DICT_VERSIONS 25217 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
25219 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
25223 #if !CYTHON_AVOID_BORROWED_REFS 25224 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 25225 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
25226 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
25227 if (likely(result)) {
25228 return __Pyx_NewRef(result);
25229 }
else if (unlikely(PyErr_Occurred())) {
25233 result = PyDict_GetItem(__pyx_d, name);
25234 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
25235 if (likely(result)) {
25236 return __Pyx_NewRef(result);
25240 result = PyObject_GetItem(__pyx_d, name);
25241 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
25242 if (likely(result)) {
25243 return __Pyx_NewRef(result);
25247 return __Pyx_GetBuiltinName(name);
25251 #if CYTHON_FAST_THREAD_STATE 25252 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25253 PyObject *tmp_type, *tmp_value, *tmp_tb;
25254 #if CYTHON_USE_EXC_INFO_STACK 25255 _PyErr_StackItem *exc_info = tstate->exc_info;
25256 tmp_type = exc_info->exc_type;
25257 tmp_value = exc_info->exc_value;
25258 tmp_tb = exc_info->exc_traceback;
25259 exc_info->exc_type = *type;
25260 exc_info->exc_value = *value;
25261 exc_info->exc_traceback = *tb;
25263 tmp_type = tstate->exc_type;
25264 tmp_value = tstate->exc_value;
25265 tmp_tb = tstate->exc_traceback;
25266 tstate->exc_type = *type;
25267 tstate->exc_value = *value;
25268 tstate->exc_traceback = *tb;
25271 *value = tmp_value;
25275 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
25276 PyObject *tmp_type, *tmp_value, *tmp_tb;
25277 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
25278 PyErr_SetExcInfo(*type, *value, *tb);
25280 *value = tmp_value;
25286 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
25287 PyObject *empty_list = 0;
25288 PyObject *module = 0;
25289 PyObject *global_dict = 0;
25290 PyObject *empty_dict = 0;
25292 #if PY_MAJOR_VERSION < 3 25293 PyObject *py_import;
25294 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
25301 empty_list = PyList_New(0);
25306 global_dict = PyModule_GetDict(__pyx_m);
25309 empty_dict = PyDict_New();
25313 #if PY_MAJOR_VERSION >= 3 25315 if (strchr(__Pyx_MODULE_NAME,
'.')) {
25316 module = PyImport_ImportModuleLevelObject(
25317 name, global_dict, empty_dict, list, 1);
25319 if (!PyErr_ExceptionMatches(PyExc_ImportError))
25328 #if PY_MAJOR_VERSION < 3 25329 PyObject *py_level = PyInt_FromLong(level);
25332 module = PyObject_CallFunctionObjArgs(py_import,
25333 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
25334 Py_DECREF(py_level);
25336 module = PyImport_ImportModuleLevelObject(
25337 name, global_dict, empty_dict, list, level);
25342 #if PY_MAJOR_VERSION < 3 25343 Py_XDECREF(py_import);
25345 Py_XDECREF(empty_list);
25346 Py_XDECREF(empty_dict);
25351 #if CYTHON_COMPILING_IN_CPYTHON 25352 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
25358 return b == &PyBaseObject_Type;
25360 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
25362 if (a == b)
return 1;
25366 n = PyTuple_GET_SIZE(mro);
25367 for (i = 0; i <
n; i++) {
25368 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
25373 return __Pyx_InBases(a, b);
25375 #if PY_MAJOR_VERSION == 2 25376 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
25377 PyObject *exception, *value, *tb;
25379 __Pyx_PyThreadState_declare
25380 __Pyx_PyThreadState_assign
25381 __Pyx_ErrFetch(&exception, &value, &tb);
25382 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
25383 if (unlikely(res == -1)) {
25384 PyErr_WriteUnraisable(err);
25388 res = PyObject_IsSubclass(err, exc_type2);
25389 if (unlikely(res == -1)) {
25390 PyErr_WriteUnraisable(err);
25394 __Pyx_ErrRestore(exception, value, tb);
25398 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
25399 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
25401 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
25406 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
25408 assert(PyExceptionClass_Check(exc_type));
25409 n = PyTuple_GET_SIZE(tuple);
25410 #if PY_MAJOR_VERSION >= 3 25411 for (i=0; i<
n; i++) {
25412 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
25415 for (i=0; i<
n; i++) {
25416 PyObject *t = PyTuple_GET_ITEM(tuple, i);
25417 #if PY_MAJOR_VERSION < 3 25418 if (likely(exc_type == t))
return 1;
25420 if (likely(PyExceptionClass_Check(t))) {
25421 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
25427 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
25428 if (likely(err == exc_type))
return 1;
25429 if (likely(PyExceptionClass_Check(err))) {
25430 if (likely(PyExceptionClass_Check(exc_type))) {
25431 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
25432 }
else if (likely(PyTuple_Check(exc_type))) {
25433 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
25437 return PyErr_GivenExceptionMatches(err, exc_type);
25439 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
25440 assert(PyExceptionClass_Check(exc_type1));
25441 assert(PyExceptionClass_Check(exc_type2));
25442 if (likely(err == exc_type1 || err == exc_type2))
return 1;
25443 if (likely(PyExceptionClass_Check(err))) {
25444 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
25446 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
25451 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
25452 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
25456 static CYTHON_INLINE
long __Pyx_div_long(
long a,
long b) {
25459 q -= ((r != 0) & ((r ^ b) < 0));
25464 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
25465 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
25466 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
25467 PyErr_Format(PyExc_ImportError,
25468 #
if PY_MAJOR_VERSION < 3
25469 "cannot import name %.230s", PyString_AS_STRING(name));
25471 "cannot import name %S", name);
25478 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *
n) {
25480 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
25481 PyErr_SetString(PyExc_TypeError,
25482 "hasattr(): attribute name must be string");
25485 r = __Pyx_GetAttr(o, n);
25486 if (unlikely(!r)) {
25496 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 25497 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
25498 PyErr_Format(PyExc_AttributeError,
25499 #
if PY_MAJOR_VERSION >= 3
25500 "'%.50s' object has no attribute '%U'",
25501 tp->tp_name, attr_name);
25503 "'%.50s' object has no attribute '%.400s'",
25504 tp->tp_name, PyString_AS_STRING(attr_name));
25508 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
25510 PyTypeObject *tp = Py_TYPE(obj);
25511 if (unlikely(!PyString_Check(attr_name))) {
25512 return PyObject_GenericGetAttr(obj, attr_name);
25514 assert(!tp->tp_dictoffset);
25515 descr = _PyType_Lookup(tp, attr_name);
25516 if (unlikely(!descr)) {
25517 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
25520 #if PY_MAJOR_VERSION < 3 25521 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
25524 descrgetfunc
f = Py_TYPE(descr)->tp_descr_get;
25526 PyObject *res =
f(descr, obj, (PyObject *)tp);
25536 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 25537 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
25538 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
25539 return PyObject_GenericGetAttr(obj, attr_name);
25541 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
25546 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
25548 PyObject *name_attr;
25549 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
25550 if (likely(name_attr)) {
25551 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
25555 if (unlikely(ret < 0)) {
25559 Py_XDECREF(name_attr);
25562 static int __Pyx_setup_reduce(PyObject* type_obj) {
25564 PyObject *object_reduce = NULL;
25565 PyObject *object_reduce_ex = NULL;
25566 PyObject *reduce = NULL;
25567 PyObject *reduce_ex = NULL;
25568 PyObject *reduce_cython = NULL;
25569 PyObject *setstate = NULL;
25570 PyObject *setstate_cython = NULL;
25571 #if CYTHON_USE_PYTYPE_LOOKUP 25572 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
25574 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
25576 #if CYTHON_USE_PYTYPE_LOOKUP 25577 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
25579 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
25581 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
25582 if (reduce_ex == object_reduce_ex) {
25583 #if CYTHON_USE_PYTYPE_LOOKUP 25584 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
25586 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
25588 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
25589 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
25590 reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython);
if (unlikely(!reduce_cython))
goto __PYX_BAD;
25591 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25592 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25593 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
25594 if (!setstate) PyErr_Clear();
25595 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
25596 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython);
if (unlikely(!setstate_cython))
goto __PYX_BAD;
25597 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25598 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25600 PyType_Modified((PyTypeObject*)type_obj);
25605 if (!PyErr_Occurred())
25606 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
25609 #if !CYTHON_USE_PYTYPE_LOOKUP 25610 Py_XDECREF(object_reduce);
25611 Py_XDECREF(object_reduce_ex);
25613 Py_XDECREF(reduce);
25614 Py_XDECREF(reduce_ex);
25615 Py_XDECREF(reduce_cython);
25616 Py_XDECREF(setstate);
25617 Py_XDECREF(setstate_cython);
25622 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
25623 #if PY_VERSION_HEX >= 0x02070000 25624 PyObject *ob = PyCapsule_New(vtable, 0, 0);
25626 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
25630 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
25640 #ifndef __PYX_HAVE_RT_ImportType 25641 #define __PYX_HAVE_RT_ImportType 25642 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
25643 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
25645 PyObject *result = 0;
25647 Py_ssize_t basicsize;
25648 #ifdef Py_LIMITED_API 25649 PyObject *py_basicsize;
25651 result = PyObject_GetAttrString(module, class_name);
25654 if (!PyType_Check(result)) {
25655 PyErr_Format(PyExc_TypeError,
25656 "%.200s.%.200s is not a type object",
25657 module_name, class_name);
25660 #ifndef Py_LIMITED_API 25661 basicsize = ((PyTypeObject *)result)->tp_basicsize;
25663 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
25666 basicsize = PyLong_AsSsize_t(py_basicsize);
25667 Py_DECREF(py_basicsize);
25669 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25672 if ((
size_t)basicsize < size) {
25673 PyErr_Format(PyExc_ValueError,
25674 "%.200s.%.200s size changed, may indicate binary incompatibility. " 25675 "Expected %zd from C header, got %zd from PyObject",
25676 module_name, class_name, size, basicsize);
25679 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
25680 PyErr_Format(PyExc_ValueError,
25681 "%.200s.%.200s size changed, may indicate binary incompatibility. " 25682 "Expected %zd from C header, got %zd from PyObject",
25683 module_name, class_name, size, basicsize);
25686 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
25687 PyOS_snprintf(warning,
sizeof(warning),
25688 "%s.%s size changed, may indicate binary incompatibility. " 25689 "Expected %zd from C header, got %zd from PyObject",
25690 module_name, class_name, size, basicsize);
25691 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
25693 return (PyTypeObject *)result;
25695 Py_XDECREF(result);
25701 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
25702 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
25703 for (i=0; i < nbases; i++) {
25704 PyTypeObject *tmptype;
25705 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
25706 tmptype = Py_TYPE(tmp);
25707 #if PY_MAJOR_VERSION < 3 25708 if (tmptype == &PyClass_Type)
25712 metaclass = tmptype;
25715 if (PyType_IsSubtype(metaclass, tmptype))
25717 if (PyType_IsSubtype(tmptype, metaclass)) {
25718 metaclass = tmptype;
25721 PyErr_SetString(PyExc_TypeError,
25722 "metaclass conflict: " 25723 "the metaclass of a derived class " 25724 "must be a (non-strict) subclass " 25725 "of the metaclasses of all its bases");
25729 #if PY_MAJOR_VERSION < 3 25730 metaclass = &PyClass_Type;
25732 metaclass = &PyType_Type;
25735 Py_INCREF((PyObject*) metaclass);
25736 return (PyObject*) metaclass;
25740 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
25741 PyObject* fake_module;
25742 PyTypeObject* cached_type = NULL;
25743 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
25744 if (!fake_module)
return NULL;
25745 Py_INCREF(fake_module);
25746 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
25748 if (!PyType_Check((PyObject*)cached_type)) {
25749 PyErr_Format(PyExc_TypeError,
25750 "Shared Cython type %.200s is not a type object",
25754 if (cached_type->tp_basicsize != type->tp_basicsize) {
25755 PyErr_Format(PyExc_TypeError,
25756 "Shared Cython type %.200s has the wrong size, try recompiling",
25761 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
25763 if (PyType_Ready(type) < 0)
goto bad;
25764 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
25767 cached_type = type;
25770 Py_DECREF(fake_module);
25771 return cached_type;
25773 Py_XDECREF(cached_type);
25774 cached_type = NULL;
25779 #include <structmember.h> 25781 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
25783 if (unlikely(op->func_doc == NULL)) {
25784 if (op->func.m_ml->ml_doc) {
25785 #if PY_MAJOR_VERSION >= 3 25786 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
25788 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
25790 if (unlikely(op->func_doc == NULL))
25793 Py_INCREF(Py_None);
25797 Py_INCREF(op->func_doc);
25798 return op->func_doc;
25801 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25803 PyObject *tmp = op->func_doc;
25804 if (value == NULL) {
25808 op->func_doc = value;
25813 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25815 if (unlikely(op->func_name == NULL)) {
25816 #if PY_MAJOR_VERSION >= 3 25817 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
25819 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
25821 if (unlikely(op->func_name == NULL))
25824 Py_INCREF(op->func_name);
25825 return op->func_name;
25828 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25831 #if PY_MAJOR_VERSION >= 3 25832 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25834 if (unlikely(value == NULL || !PyString_Check(value)))
25837 PyErr_SetString(PyExc_TypeError,
25838 "__name__ must be set to a string object");
25841 tmp = op->func_name;
25843 op->func_name = value;
25848 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25850 Py_INCREF(op->func_qualname);
25851 return op->func_qualname;
25854 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25857 #if PY_MAJOR_VERSION >= 3 25858 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25860 if (unlikely(value == NULL || !PyString_Check(value)))
25863 PyErr_SetString(PyExc_TypeError,
25864 "__qualname__ must be set to a string object");
25867 tmp = op->func_qualname;
25869 op->func_qualname = value;
25874 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
25877 self = m->func_closure;
25884 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25886 if (unlikely(op->func_dict == NULL)) {
25887 op->func_dict = PyDict_New();
25888 if (unlikely(op->func_dict == NULL))
25891 Py_INCREF(op->func_dict);
25892 return op->func_dict;
25895 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25898 if (unlikely(value == NULL)) {
25899 PyErr_SetString(PyExc_TypeError,
25900 "function's dictionary may not be deleted");
25903 if (unlikely(!PyDict_Check(value))) {
25904 PyErr_SetString(PyExc_TypeError,
25905 "setting function's dictionary to a non-dict");
25908 tmp = op->func_dict;
25910 op->func_dict = value;
25915 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25917 Py_INCREF(op->func_globals);
25918 return op->func_globals;
25921 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25923 Py_INCREF(Py_None);
25927 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25929 PyObject* result = (op->func_code) ? op->func_code : Py_None;
25934 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
25936 PyObject *res = op->defaults_getter((PyObject *) op);
25937 if (unlikely(!res))
25939 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 25940 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
25941 Py_INCREF(op->defaults_tuple);
25942 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
25943 Py_INCREF(op->defaults_kwdict);
25945 op->defaults_tuple = PySequence_ITEM(res, 0);
25946 if (unlikely(!op->defaults_tuple)) result = -1;
25948 op->defaults_kwdict = PySequence_ITEM(res, 1);
25949 if (unlikely(!op->defaults_kwdict)) result = -1;
25956 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25960 }
else if (value != Py_None && !PyTuple_Check(value)) {
25961 PyErr_SetString(PyExc_TypeError,
25962 "__defaults__ must be set to a tuple object");
25966 tmp = op->defaults_tuple;
25967 op->defaults_tuple = value;
25972 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25973 PyObject* result = op->defaults_tuple;
25974 if (unlikely(!result)) {
25975 if (op->defaults_getter) {
25976 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
25977 result = op->defaults_tuple;
25986 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25990 }
else if (value != Py_None && !PyDict_Check(value)) {
25991 PyErr_SetString(PyExc_TypeError,
25992 "__kwdefaults__ must be set to a dict object");
25996 tmp = op->defaults_kwdict;
25997 op->defaults_kwdict = value;
26002 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
26003 PyObject* result = op->defaults_kwdict;
26004 if (unlikely(!result)) {
26005 if (op->defaults_getter) {
26006 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
26007 result = op->defaults_kwdict;
26016 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
26018 if (!value || value == Py_None) {
26020 }
else if (!PyDict_Check(value)) {
26021 PyErr_SetString(PyExc_TypeError,
26022 "__annotations__ must be set to a dict object");
26026 tmp = op->func_annotations;
26027 op->func_annotations = value;
26032 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
26033 PyObject* result = op->func_annotations;
26034 if (unlikely(!result)) {
26035 result = PyDict_New();
26036 if (unlikely(!result))
return NULL;
26037 op->func_annotations = result;
26042 static PyGetSetDef __pyx_CyFunction_getsets[] = {
26043 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
26044 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
26045 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
26046 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
26047 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
26048 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
26049 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
26050 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
26051 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
26052 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
26053 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
26054 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
26055 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
26056 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
26057 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
26058 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
26059 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
26060 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
26063 static PyMemberDef __pyx_CyFunction_members[] = {
26064 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
26068 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
26070 #if PY_MAJOR_VERSION >= 3 26071 return PyUnicode_FromString(m->func.m_ml->ml_name);
26073 return PyString_FromString(m->func.m_ml->ml_name);
26076 static PyMethodDef __pyx_CyFunction_methods[] = {
26077 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
26080 #if PY_VERSION_HEX < 0x030500A0 26081 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) 26083 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) 26085 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml,
int flags, PyObject* qualname,
26086 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
26087 __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
26091 __Pyx_CyFunction_weakreflist(op) = NULL;
26092 op->func.m_ml = ml;
26093 op->func.m_self = (PyObject *) op;
26094 Py_XINCREF(closure);
26095 op->func_closure = closure;
26096 Py_XINCREF(module);
26097 op->func.m_module = module;
26098 op->func_dict = NULL;
26099 op->func_name = NULL;
26100 Py_INCREF(qualname);
26101 op->func_qualname = qualname;
26102 op->func_doc = NULL;
26103 op->func_classobj = NULL;
26104 op->func_globals = globals;
26105 Py_INCREF(op->func_globals);
26107 op->func_code = code;
26108 op->defaults_pyobjects = 0;
26109 op->defaults_size = 0;
26110 op->defaults = NULL;
26111 op->defaults_tuple = NULL;
26112 op->defaults_kwdict = NULL;
26113 op->defaults_getter = NULL;
26114 op->func_annotations = NULL;
26115 PyObject_GC_Track(op);
26116 return (PyObject *) op;
26119 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
26121 Py_CLEAR(m->func_closure);
26122 Py_CLEAR(m->func.m_module);
26123 Py_CLEAR(m->func_dict);
26124 Py_CLEAR(m->func_name);
26125 Py_CLEAR(m->func_qualname);
26126 Py_CLEAR(m->func_doc);
26127 Py_CLEAR(m->func_globals);
26128 Py_CLEAR(m->func_code);
26129 Py_CLEAR(m->func_classobj);
26130 Py_CLEAR(m->defaults_tuple);
26131 Py_CLEAR(m->defaults_kwdict);
26132 Py_CLEAR(m->func_annotations);
26134 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
26136 for (i = 0; i < m->defaults_pyobjects; i++)
26137 Py_XDECREF(pydefaults[i]);
26138 PyObject_Free(m->defaults);
26139 m->defaults = NULL;
26143 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
26145 if (__Pyx_CyFunction_weakreflist(m) != NULL)
26146 PyObject_ClearWeakRefs((PyObject *) m);
26147 __Pyx_CyFunction_clear(m);
26148 PyObject_GC_Del(m);
26150 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
26152 PyObject_GC_UnTrack(m);
26153 __Pyx__CyFunction_dealloc(m);
26155 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
26157 Py_VISIT(m->func_closure);
26158 Py_VISIT(m->func.m_module);
26159 Py_VISIT(m->func_dict);
26160 Py_VISIT(m->func_name);
26161 Py_VISIT(m->func_qualname);
26162 Py_VISIT(m->func_doc);
26163 Py_VISIT(m->func_globals);
26164 Py_VISIT(m->func_code);
26165 Py_VISIT(m->func_classobj);
26166 Py_VISIT(m->defaults_tuple);
26167 Py_VISIT(m->defaults_kwdict);
26169 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
26171 for (i = 0; i < m->defaults_pyobjects; i++)
26172 Py_VISIT(pydefaults[i]);
26176 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
26178 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26179 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
26183 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
26185 type = (PyObject *)(Py_TYPE(obj));
26186 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
26188 if (obj == Py_None)
26190 return __Pyx_PyMethod_New(func, obj, type);
26193 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
26195 #if PY_MAJOR_VERSION >= 3 26196 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
26197 op->func_qualname, (
void *)op);
26199 return PyString_FromFormat(
"<cyfunction %s at %p>",
26200 PyString_AsString(op->func_qualname), (
void *)op);
26203 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
26204 PyCFunctionObject*
f = (PyCFunctionObject*)func;
26205 PyCFunction meth = f->m_ml->ml_meth;
26207 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
26209 if (likely(kw == NULL || PyDict_Size(kw) == 0))
26210 return (*meth)(
self, arg);
26212 case METH_VARARGS | METH_KEYWORDS:
26213 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
26215 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
26216 size = PyTuple_GET_SIZE(arg);
26217 if (likely(size == 0))
26218 return (*meth)(
self, NULL);
26219 PyErr_Format(PyExc_TypeError,
26220 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
26221 f->m_ml->ml_name, size);
26226 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
26227 size = PyTuple_GET_SIZE(arg);
26228 if (likely(size == 1)) {
26229 PyObject *result, *arg0;
26230 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 26231 arg0 = PyTuple_GET_ITEM(arg, 0);
26233 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
26235 result = (*meth)(
self, arg0);
26236 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) 26241 PyErr_Format(PyExc_TypeError,
26242 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
26243 f->m_ml->ml_name, size);
26248 PyErr_SetString(PyExc_SystemError,
"Bad call flags in " 26249 "__Pyx_CyFunction_Call. METH_OLDARGS is no " 26250 "longer supported!");
26253 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
26257 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
26258 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
26260 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
26262 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
26263 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
26265 PyObject *new_args;
26267 argc = PyTuple_GET_SIZE(args);
26268 new_args = PyTuple_GetSlice(args, 1, argc);
26269 if (unlikely(!new_args))
26271 self = PyTuple_GetItem(args, 0);
26272 if (unlikely(!
self)) {
26273 Py_DECREF(new_args);
26276 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
26277 Py_DECREF(new_args);
26279 result = __Pyx_CyFunction_Call(func, args, kw);
26283 static PyTypeObject __pyx_CyFunctionType_type = {
26284 PyVarObject_HEAD_INIT(0, 0)
26285 "cython_function_or_method",
26286 sizeof(__pyx_CyFunctionObject),
26288 (destructor) __Pyx_CyFunction_dealloc,
26292 #if PY_MAJOR_VERSION < 3 26297 (reprfunc) __Pyx_CyFunction_repr,
26302 __Pyx_CyFunction_CallAsMethod,
26307 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
26309 (traverseproc) __Pyx_CyFunction_traverse,
26310 (inquiry) __Pyx_CyFunction_clear,
26312 #
if PY_VERSION_HEX < 0x030500A0
26313 offsetof(__pyx_CyFunctionObject, func_weakreflist),
26315 offsetof(PyCFunctionObject, m_weakreflist),
26319 __pyx_CyFunction_methods,
26320 __pyx_CyFunction_members,
26321 __pyx_CyFunction_getsets,
26324 __Pyx_CyFunction_descr_get,
26326 offsetof(__pyx_CyFunctionObject, func_dict),
26339 #if PY_VERSION_HEX >= 0x030400a1 26342 #if PY_VERSION_HEX >= 0x030800b1 26345 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 26349 static int __pyx_CyFunction_init(
void) {
26350 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
26351 if (unlikely(__pyx_CyFunctionType == NULL)) {
26356 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
26357 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26358 m->defaults = PyObject_Malloc(size);
26359 if (unlikely(!m->defaults))
26360 return PyErr_NoMemory();
26361 memset(m->defaults, 0, size);
26362 m->defaults_pyobjects = pyobjects;
26363 m->defaults_size = size;
26364 return m->defaults;
26366 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
26367 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26368 m->defaults_tuple = tuple;
26371 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
26372 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26373 m->defaults_kwdict = dict;
26376 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
26377 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26378 m->func_annotations = dict;
26383 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
26384 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
26387 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
26389 PyObject *pargs = PyTuple_Pack(2, name, bases);
26390 if (unlikely(!pargs)) {
26394 ns = PyObject_Call(prep, pargs, mkw);
26398 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
26408 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0))
goto bad;
26409 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0))
goto bad;
26410 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0))
goto bad;
26416 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
26417 PyObject *dict, PyObject *mkw,
26418 int calculate_metaclass,
int allow_py2_metaclass) {
26419 PyObject *result, *margs;
26420 PyObject *owned_metaclass = NULL;
26421 if (allow_py2_metaclass) {
26422 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
26423 if (owned_metaclass) {
26424 metaclass = owned_metaclass;
26425 }
else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
26431 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
26432 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
26433 Py_XDECREF(owned_metaclass);
26434 if (unlikely(!metaclass))
26436 owned_metaclass = metaclass;
26438 margs = PyTuple_Pack(3, name, bases, dict);
26439 if (unlikely(!margs)) {
26442 result = PyObject_Call(metaclass, margs, mkw);
26445 Py_XDECREF(owned_metaclass);
26450 #ifndef CYTHON_CLINE_IN_TRACEBACK 26451 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
26452 PyObject *use_cline;
26453 PyObject *ptype, *pvalue, *ptraceback;
26454 #if CYTHON_COMPILING_IN_CPYTHON 26455 PyObject **cython_runtime_dict;
26457 if (unlikely(!__pyx_cython_runtime)) {
26460 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
26461 #if CYTHON_COMPILING_IN_CPYTHON 26462 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
26463 if (likely(cython_runtime_dict)) {
26464 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
26465 use_cline, *cython_runtime_dict,
26466 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
26470 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
26471 if (use_cline_obj) {
26472 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
26473 Py_DECREF(use_cline_obj);
26481 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
26483 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
26486 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
26492 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
26493 int start = 0, mid = 0, end = count - 1;
26494 if (end >= 0 && code_line > entries[end].code_line) {
26497 while (start < end) {
26498 mid = start + (end - start) / 2;
26499 if (code_line < entries[mid].code_line) {
26501 }
else if (code_line > entries[mid].code_line) {
26507 if (code_line <= entries[mid].code_line) {
26513 static PyCodeObject *__pyx_find_code_object(
int code_line) {
26514 PyCodeObject* code_object;
26516 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
26519 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26520 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
26523 code_object = __pyx_code_cache.entries[
pos].code_object;
26524 Py_INCREF(code_object);
26525 return code_object;
26527 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
26529 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
26530 if (unlikely(!code_line)) {
26533 if (unlikely(!entries)) {
26534 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
26535 if (likely(entries)) {
26536 __pyx_code_cache.entries = entries;
26537 __pyx_code_cache.max_count = 64;
26538 __pyx_code_cache.count = 1;
26539 entries[0].code_line = code_line;
26540 entries[0].code_object = code_object;
26541 Py_INCREF(code_object);
26545 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26546 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
26547 PyCodeObject* tmp = entries[
pos].code_object;
26548 entries[
pos].code_object = code_object;
26552 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
26553 int new_max = __pyx_code_cache.max_count + 64;
26554 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
26555 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
26556 if (unlikely(!entries)) {
26559 __pyx_code_cache.entries = entries;
26560 __pyx_code_cache.max_count = new_max;
26562 for (i=__pyx_code_cache.count; i>pos; i--) {
26563 entries[i] = entries[i-1];
26565 entries[
pos].code_line = code_line;
26566 entries[
pos].code_object = code_object;
26567 __pyx_code_cache.count++;
26568 Py_INCREF(code_object);
26572 #include "compile.h" 26573 #include "frameobject.h" 26574 #include "traceback.h" 26575 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
26576 const char *funcname,
int c_line,
26577 int py_line,
const char *filename) {
26578 PyCodeObject *py_code = 0;
26579 PyObject *py_srcfile = 0;
26580 PyObject *py_funcname = 0;
26581 #if PY_MAJOR_VERSION < 3 26582 py_srcfile = PyString_FromString(filename);
26584 py_srcfile = PyUnicode_FromString(filename);
26586 if (!py_srcfile)
goto bad;
26588 #if PY_MAJOR_VERSION < 3 26589 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26591 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26595 #if PY_MAJOR_VERSION < 3 26596 py_funcname = PyString_FromString(funcname);
26598 py_funcname = PyUnicode_FromString(funcname);
26601 if (!py_funcname)
goto bad;
26602 py_code = __Pyx_PyCode_New(
26619 Py_DECREF(py_srcfile);
26620 Py_DECREF(py_funcname);
26623 Py_XDECREF(py_srcfile);
26624 Py_XDECREF(py_funcname);
26627 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
26628 int py_line,
const char *filename) {
26629 PyCodeObject *py_code = 0;
26630 PyFrameObject *py_frame = 0;
26631 PyThreadState *tstate = __Pyx_PyThreadState_Current;
26633 c_line = __Pyx_CLineForTraceback(tstate, c_line);
26635 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
26637 py_code = __Pyx_CreateCodeObjectForTraceback(
26638 funcname, c_line, py_line, filename);
26639 if (!py_code)
goto bad;
26640 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
26642 py_frame = PyFrame_New(
26648 if (!py_frame)
goto bad;
26649 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
26650 PyTraceBack_Here(py_frame);
26652 Py_XDECREF(py_code);
26653 Py_XDECREF(py_frame);
26656 #if PY_MAJOR_VERSION < 3 26657 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
26658 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
26659 if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray))
return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
26660 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
26661 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
26662 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
26665 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
26666 PyObject *obj = view->obj;
26668 if (PyObject_CheckBuffer(obj)) {
26669 PyBuffer_Release(view);
26673 else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
26682 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
26684 int i, index, step, start;
26685 Py_ssize_t itemsize = mvs.memview->view.itemsize;
26686 if (order ==
'F') {
26693 for (i = 0; i < ndim; i++) {
26694 index = start + step * i;
26695 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
26697 itemsize *= mvs.shape[index];
26704 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
26705 void **out_start,
void **out_end,
26706 int ndim,
size_t itemsize)
26710 start = end = slice->data;
26711 for (i = 0; i < ndim; i++) {
26712 Py_ssize_t stride = slice->strides[i];
26713 Py_ssize_t extent = slice->shape[i];
26715 *out_start = *out_end = start;
26719 end += stride * (extent - 1);
26721 start += stride * (extent - 1);
26724 *out_start = start;
26725 *out_end = end + itemsize;
26728 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
26729 __Pyx_memviewslice *slice2,
26730 int ndim,
size_t itemsize)
26732 void *start1, *end1, *start2, *end2;
26733 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
26734 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
26735 return (start1 < end2) && (start2 < end1);
26739 static CYTHON_INLINE PyObject *
26740 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
26743 #if PY_VERSION_HEX >= 0x02070000 26744 cobj = PyCapsule_New(p, sig, NULL);
26746 cobj = PyCObject_FromVoidPtr(p, NULL);
26752 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ 26753 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) 26754 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ 26755 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) 26756 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ 26758 func_type value = func_value;\ 26759 if (sizeof(target_type) < sizeof(func_type)) {\ 26760 if (unlikely(value != (func_type) (target_type) value)) {\ 26761 func_type zero = 0;\ 26762 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ 26763 return (target_type) -1;\ 26764 if (is_unsigned && unlikely(value < zero))\ 26765 goto raise_neg_overflow;\ 26767 goto raise_overflow;\ 26770 return (target_type) value;\ 26774 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
26780 S.u32 = 0x01020304;
26781 return S.u8[0] == 4;
26785 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
26786 __Pyx_BufFmt_StackElem* stack,
26787 __Pyx_TypeInfo* type) {
26788 stack[0].field = &ctx->root;
26789 stack[0].parent_offset = 0;
26790 ctx->root.type = type;
26791 ctx->root.name =
"buffer dtype";
26792 ctx->root.offset = 0;
26794 ctx->head->field = &ctx->root;
26795 ctx->fmt_offset = 0;
26796 ctx->head->parent_offset = 0;
26797 ctx->new_packmode =
'@';
26798 ctx->enc_packmode =
'@';
26799 ctx->new_count = 1;
26800 ctx->enc_count = 0;
26802 ctx->is_complex = 0;
26803 ctx->is_valid_array = 0;
26804 ctx->struct_alignment = 0;
26805 while (type->typegroup ==
'S') {
26807 ctx->head->field = type->fields;
26808 ctx->head->parent_offset = 0;
26809 type = type->fields->type;
26812 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
26814 const char* t = *ts;
26815 if (*t < '0' || *t >
'9') {
26818 count = *t++ -
'0';
26819 while (*t >=
'0' && *t <=
'9') {
26821 count += *t++ -
'0';
26827 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
26828 int number = __Pyx_BufFmt_ParseNumber(ts);
26830 PyErr_Format(PyExc_ValueError,\
26831 "Does not understand character buffer dtype format string ('%c')", **ts);
26834 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
26835 PyErr_Format(PyExc_ValueError,
26836 "Unexpected format string character: '%c'", ch);
26838 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
26840 case '?':
return "'bool'";
26841 case 'c':
return "'char'";
26842 case 'b':
return "'signed char'";
26843 case 'B':
return "'unsigned char'";
26844 case 'h':
return "'short'";
26845 case 'H':
return "'unsigned short'";
26846 case 'i':
return "'int'";
26847 case 'I':
return "'unsigned int'";
26848 case 'l':
return "'long'";
26849 case 'L':
return "'unsigned long'";
26850 case 'q':
return "'long long'";
26851 case 'Q':
return "'unsigned long long'";
26852 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
26853 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
26854 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
26855 case 'T':
return "a struct";
26856 case 'O':
return "Python object";
26857 case 'P':
return "a pointer";
26858 case 's':
case 'p':
return "a string";
26859 case 0:
return "end";
26860 default:
return "unparseable format string";
26863 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
26865 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26866 case 'h':
case 'H':
return 2;
26867 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
26868 case 'q':
case 'Q':
return 8;
26869 case 'f':
return (is_complex ? 8 : 4);
26870 case 'd':
return (is_complex ? 16 : 8);
26872 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
26875 case 'O':
case 'P':
return sizeof(
void*);
26877 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26881 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
26883 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26884 case 'h':
case 'H':
return sizeof(short);
26885 case 'i':
case 'I':
return sizeof(int);
26886 case 'l':
case 'L':
return sizeof(long);
26887 #ifdef HAVE_LONG_LONG 26888 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
26890 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
26891 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
26892 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
26893 case 'O':
case 'P':
return sizeof(
void*);
26895 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26900 typedef struct {
char c;
short x; } __Pyx_st_short;
26901 typedef struct {
char c;
int x; } __Pyx_st_int;
26902 typedef struct {
char c;
long x; } __Pyx_st_long;
26903 typedef struct {
char c;
float x; } __Pyx_st_float;
26904 typedef struct {
char c;
double x; } __Pyx_st_double;
26905 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
26906 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
26907 #ifdef HAVE_LONG_LONG 26908 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
26910 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
26912 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26913 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
26914 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
26915 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
26916 #ifdef HAVE_LONG_LONG 26917 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
26919 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
26920 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
26921 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
26922 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
26924 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26932 typedef struct {
short x;
char c; } __Pyx_pad_short;
26933 typedef struct {
int x;
char c; } __Pyx_pad_int;
26934 typedef struct {
long x;
char c; } __Pyx_pad_long;
26935 typedef struct {
float x;
char c; } __Pyx_pad_float;
26936 typedef struct {
double x;
char c; } __Pyx_pad_double;
26937 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
26938 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
26939 #ifdef HAVE_LONG_LONG 26940 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
26942 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
26944 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26945 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
26946 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
26947 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
26948 #ifdef HAVE_LONG_LONG 26949 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
26951 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
26952 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
26953 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
26954 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
26956 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26960 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
26964 case 'b':
case 'h':
case 'i':
26965 case 'l':
case 'q':
case 's':
case 'p':
26967 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
26969 case 'f':
case 'd':
case 'g':
26970 return (is_complex ?
'C' :
'R');
26976 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26981 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
26982 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
26983 const char* expected;
26985 if (ctx->head == NULL) {
26989 expected = ctx->head->field->type->name;
26992 PyErr_Format(PyExc_ValueError,
26993 "Buffer dtype mismatch, expected %s%s%s but got %s",
26994 quote, expected, quote,
26995 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
26997 __Pyx_StructField* field = ctx->head->field;
26998 __Pyx_StructField* parent = (ctx->head - 1)->field;
26999 PyErr_Format(PyExc_ValueError,
27000 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
27001 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
27002 parent->type->name, field->name);
27005 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
27007 size_t size, offset, arraysize = 1;
27008 if (ctx->enc_type == 0)
return 0;
27009 if (ctx->head->field->type->arraysize[0]) {
27011 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
27012 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
27014 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
27015 PyErr_Format(PyExc_ValueError,
27016 "Expected a dimension of size %zu, got %zu",
27017 ctx->head->field->type->arraysize[0], ctx->enc_count);
27021 if (!ctx->is_valid_array) {
27022 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
27023 ctx->head->field->type->ndim, ndim);
27026 for (i = 0; i < ctx->head->field->type->ndim; i++) {
27027 arraysize *= ctx->head->field->type->arraysize[i];
27029 ctx->is_valid_array = 0;
27030 ctx->enc_count = 1;
27032 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
27034 __Pyx_StructField* field = ctx->head->field;
27035 __Pyx_TypeInfo* type = field->type;
27036 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
27037 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
27039 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
27041 if (ctx->enc_packmode ==
'@') {
27042 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
27043 size_t align_mod_offset;
27044 if (align_at == 0)
return -1;
27045 align_mod_offset = ctx->fmt_offset % align_at;
27046 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
27047 if (ctx->struct_alignment == 0)
27048 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
27051 if (type->size != size || type->typegroup != group) {
27052 if (type->typegroup ==
'C' && type->fields != NULL) {
27053 size_t parent_offset = ctx->head->parent_offset + field->offset;
27055 ctx->head->field = type->fields;
27056 ctx->head->parent_offset = parent_offset;
27059 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
27061 __Pyx_BufFmt_RaiseExpected(ctx);
27065 offset = ctx->head->parent_offset + field->offset;
27066 if (ctx->fmt_offset != offset) {
27067 PyErr_Format(PyExc_ValueError,
27068 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
27069 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
27072 ctx->fmt_offset += size;
27074 ctx->fmt_offset += (arraysize - 1) * size;
27077 if (field == &ctx->root) {
27079 if (ctx->enc_count != 0) {
27080 __Pyx_BufFmt_RaiseExpected(ctx);
27085 ctx->head->field = ++field;
27086 if (field->type == NULL) {
27088 field = ctx->head->field;
27090 }
else if (field->type->typegroup ==
'S') {
27091 size_t parent_offset = ctx->head->parent_offset + field->offset;
27092 if (field->type->fields->type == NULL)
continue;
27093 field = field->type->fields;
27095 ctx->head->field = field;
27096 ctx->head->parent_offset = parent_offset;
27102 }
while (ctx->enc_count);
27104 ctx->is_complex = 0;
27108 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
27110 const char *ts = *tsp;
27112 int ndim = ctx->head->field->type->ndim;
27115 if (ctx->new_count != 1) {
27116 PyErr_SetString(PyExc_ValueError,
27117 "Cannot handle repeated arrays in format string");
27120 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27121 while (*ts && *ts !=
')') {
27123 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
27126 number = __Pyx_BufFmt_ExpectNumber(&ts);
27127 if (
number == -1)
return NULL;
27128 if (i < ndim && (
size_t)
number != ctx->head->field->type->arraysize[i])
27129 return PyErr_Format(PyExc_ValueError,
27130 "Expected a dimension of size %zu, got %d",
27131 ctx->head->field->type->arraysize[i],
number);
27132 if (*ts !=
',' && *ts !=
')')
27133 return PyErr_Format(PyExc_ValueError,
27134 "Expected a comma in format string, got '%c'", *ts);
27135 if (*ts ==
',') ts++;
27139 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
27140 ctx->head->field->type->ndim, i);
27142 PyErr_SetString(PyExc_ValueError,
27143 "Unexpected end of format string, expected ')'");
27146 ctx->is_valid_array = 1;
27147 ctx->new_count = 1;
27151 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
27156 if (ctx->enc_type != 0 && ctx->head == NULL) {
27157 __Pyx_BufFmt_RaiseExpected(ctx);
27160 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27161 if (ctx->head != NULL) {
27162 __Pyx_BufFmt_RaiseExpected(ctx);
27172 if (!__Pyx_Is_Little_Endian()) {
27173 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
27176 ctx->new_packmode =
'=';
27181 if (__Pyx_Is_Little_Endian()) {
27182 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
27185 ctx->new_packmode =
'=';
27191 ctx->new_packmode = *ts++;
27195 const char* ts_after_sub;
27196 size_t i, struct_count = ctx->new_count;
27197 size_t struct_alignment = ctx->struct_alignment;
27198 ctx->new_count = 1;
27201 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
27204 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27206 ctx->enc_count = 0;
27207 ctx->struct_alignment = 0;
27210 for (i = 0; i != struct_count; ++i) {
27211 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
27212 if (!ts_after_sub)
return NULL;
27215 if (struct_alignment) ctx->struct_alignment = struct_alignment;
27220 size_t alignment = ctx->struct_alignment;
27222 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27224 if (alignment && ctx->fmt_offset % alignment) {
27225 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
27230 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27231 ctx->fmt_offset += ctx->new_count;
27232 ctx->new_count = 1;
27233 ctx->enc_count = 0;
27235 ctx->enc_packmode = ctx->new_packmode;
27241 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
27242 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
27245 CYTHON_FALLTHROUGH;
27246 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
27247 case 'l':
case 'L':
case 'q':
case 'Q':
27248 case 'f':
case 'd':
case 'g':
27249 case 'O':
case 'p':
27250 if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
27251 ctx->enc_packmode == ctx->new_packmode) {
27252 ctx->enc_count += ctx->new_count;
27253 ctx->new_count = 1;
27258 CYTHON_FALLTHROUGH;
27260 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27261 ctx->enc_count = ctx->new_count;
27262 ctx->enc_packmode = ctx->new_packmode;
27263 ctx->enc_type = *ts;
27264 ctx->is_complex = got_Z;
27266 ctx->new_count = 1;
27271 while(*ts !=
':') ++ts;
27275 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
27279 int number = __Pyx_BufFmt_ExpectNumber(&ts);
27280 if (number == -1)
return NULL;
27281 ctx->new_count = (size_t)number;
27289 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
27296 if (a->size != b->size || a->typegroup != b->typegroup ||
27297 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
27298 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
27299 return a->size == b->size;
27305 for (i = 0; i < a->ndim; i++)
27306 if (a->arraysize[i] != b->arraysize[i])
27309 if (a->typegroup ==
'S') {
27310 if (a->flags != b->flags)
27312 if (a->fields || b->fields) {
27313 if (!(a->fields && b->fields))
27315 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
27316 __Pyx_StructField *field_a = a->fields + i;
27317 __Pyx_StructField *field_b = b->fields + i;
27318 if (field_a->offset != field_b->offset ||
27319 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
27322 return !a->fields[i].type && !b->fields[i].type;
27330 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
27332 if (buf->shape[dim] <= 1)
27334 if (buf->strides) {
27335 if (spec & __Pyx_MEMVIEW_CONTIG) {
27336 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
27337 if (buf->strides[dim] !=
sizeof(
void *)) {
27338 PyErr_Format(PyExc_ValueError,
27339 "Buffer is not indirectly contiguous " 27340 "in dimension %d.", dim);
27343 }
else if (buf->strides[dim] != buf->itemsize) {
27344 PyErr_SetString(PyExc_ValueError,
27345 "Buffer and memoryview are not contiguous " 27346 "in the same dimension.");
27350 if (spec & __Pyx_MEMVIEW_FOLLOW) {
27351 Py_ssize_t stride = buf->strides[dim];
27354 if (stride < buf->itemsize) {
27355 PyErr_SetString(PyExc_ValueError,
27356 "Buffer and memoryview are not contiguous " 27357 "in the same dimension.");
27362 if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
27363 PyErr_Format(PyExc_ValueError,
27364 "C-contiguous buffer is not contiguous in " 27365 "dimension %d", dim);
27367 }
else if (spec & (__Pyx_MEMVIEW_PTR)) {
27368 PyErr_Format(PyExc_ValueError,
27369 "C-contiguous buffer is not indirect in " 27370 "dimension %d", dim);
27372 }
else if (buf->suboffsets) {
27373 PyErr_SetString(PyExc_ValueError,
27374 "Buffer exposes suboffsets but no strides");
27383 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
27385 if (spec & __Pyx_MEMVIEW_DIRECT) {
27386 if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
27387 PyErr_Format(PyExc_ValueError,
27388 "Buffer not compatible with direct access " 27389 "in dimension %d.", dim);
27393 if (spec & __Pyx_MEMVIEW_PTR) {
27394 if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
27395 PyErr_Format(PyExc_ValueError,
27396 "Buffer is not indirectly accessible " 27397 "in dimension %d.", dim);
27406 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
27409 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
27410 Py_ssize_t stride = 1;
27411 for (i = 0; i < ndim; i++) {
27412 if (stride * buf->itemsize != buf->strides[i] &&
27415 PyErr_SetString(PyExc_ValueError,
27416 "Buffer not fortran contiguous.");
27419 stride = stride * buf->shape[i];
27421 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
27422 Py_ssize_t stride = 1;
27423 for (i = ndim - 1; i >- 1; i--) {
27424 if (stride * buf->itemsize != buf->strides[i] &&
27425 buf->shape[i] > 1) {
27426 PyErr_SetString(PyExc_ValueError,
27427 "Buffer not C contiguous.");
27430 stride = stride * buf->shape[i];
27437 static int __Pyx_ValidateAndInit_memviewslice(
27442 __Pyx_TypeInfo *dtype,
27443 __Pyx_BufFmt_StackElem stack[],
27444 __Pyx_memviewslice *memviewslice,
27445 PyObject *original_obj)
27447 struct __pyx_memoryview_obj *memview, *new_memview;
27448 __Pyx_RefNannyDeclarations
27450 int i, spec = 0, retval = -1;
27451 __Pyx_BufFmt_Context ctx;
27452 int from_memoryview = __pyx_memoryview_check(original_obj);
27453 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
27454 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
27455 original_obj)->typeinfo)) {
27456 memview = (
struct __pyx_memoryview_obj *) original_obj;
27457 new_memview = NULL;
27459 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
27460 original_obj, buf_flags, 0, dtype);
27461 new_memview = memview;
27462 if (unlikely(!memview))
27465 buf = &memview->view;
27466 if (buf->ndim != ndim) {
27467 PyErr_Format(PyExc_ValueError,
27468 "Buffer has wrong number of dimensions (expected %d, got %d)",
27473 __Pyx_BufFmt_Init(&ctx, stack, dtype);
27474 if (!__Pyx_BufFmt_CheckString(&ctx, buf->format))
goto fail;
27476 if ((
unsigned) buf->itemsize != dtype->size) {
27477 PyErr_Format(PyExc_ValueError,
27478 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) " 27479 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
27481 (buf->itemsize > 1) ?
"s" :
"",
27484 (dtype->size > 1) ?
"s" :
"");
27487 for (i = 0; i < ndim; i++) {
27488 spec = axes_specs[i];
27489 if (!__pyx_check_strides(buf, i, ndim, spec))
27491 if (!__pyx_check_suboffsets(buf, i, ndim, spec))
27494 if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
27496 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
27497 new_memview != NULL) == -1)) {
27503 Py_XDECREF(new_memview);
27506 __Pyx_RefNannyFinishContext();
27511 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj,
int writable_flag) {
27512 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27513 __Pyx_BufFmt_StackElem stack[1];
27514 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27516 if (obj == Py_None) {
27517 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
27520 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27521 PyBUF_RECORDS_RO | writable_flag, 1,
27522 &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
27524 if (unlikely(retcode == -1))
27528 result.memview = NULL;
27529 result.data = NULL;
27534 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int32_t(PyObject *obj,
int writable_flag) {
27535 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27536 __Pyx_BufFmt_StackElem stack[1];
27537 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27539 if (obj == Py_None) {
27540 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
27543 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27544 PyBUF_RECORDS_RO | writable_flag, 1,
27545 &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, stack,
27547 if (unlikely(retcode == -1))
27551 result.memview = NULL;
27552 result.data = NULL;
27557 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) {
27558 const npy_int32 neg_one = (npy_int32) ((npy_int32) 0 - (npy_int32) 1), const_zero = (npy_int32) 0;
27559 const int is_unsigned = neg_one > const_zero;
27561 if (
sizeof(npy_int32) <
sizeof(long)) {
27562 return PyInt_FromLong((
long) value);
27563 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned long)) {
27564 return PyLong_FromUnsignedLong((
unsigned long) value);
27565 #ifdef HAVE_LONG_LONG 27566 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned PY_LONG_LONG)) {
27567 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27571 if (
sizeof(npy_int32) <=
sizeof(
long)) {
27572 return PyInt_FromLong((
long) value);
27573 #ifdef HAVE_LONG_LONG 27574 }
else if (
sizeof(npy_int32) <=
sizeof(PY_LONG_LONG)) {
27575 return PyLong_FromLongLong((PY_LONG_LONG) value);
27580 int one = 1;
int little = (int)*(
unsigned char *)&one;
27581 unsigned char *bytes = (
unsigned char *)&value;
27582 return _PyLong_FromByteArray(bytes,
sizeof(npy_int32),
27583 little, !is_unsigned);
27588 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
27589 const int neg_one = (int) ((
int) 0 - (int) 1), const_zero = (int) 0;
27590 const int is_unsigned = neg_one > const_zero;
27592 if (
sizeof(
int) <
sizeof(long)) {
27593 return PyInt_FromLong((
long) value);
27594 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27595 return PyLong_FromUnsignedLong((
unsigned long) value);
27596 #ifdef HAVE_LONG_LONG 27597 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27598 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27602 if (
sizeof(
int) <=
sizeof(
long)) {
27603 return PyInt_FromLong((
long) value);
27604 #ifdef HAVE_LONG_LONG 27605 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27606 return PyLong_FromLongLong((PY_LONG_LONG) value);
27611 int one = 1;
int little = (int)*(
unsigned char *)&one;
27612 unsigned char *bytes = (
unsigned char *)&value;
27613 return _PyLong_FromByteArray(bytes,
sizeof(
int),
27614 little, !is_unsigned);
27619 #if CYTHON_CCOMPLEX 27621 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27622 return ::std::complex< float >(x, y);
27625 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27626 return x + y*(__pyx_t_float_complex)_Complex_I;
27630 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27631 __pyx_t_float_complex
z;
27639 #if CYTHON_CCOMPLEX 27641 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27642 return (a.real == b.real) && (a.imag == b.imag);
27644 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27645 __pyx_t_float_complex
z;
27646 z.real = a.real + b.real;
27647 z.imag = a.imag + b.imag;
27650 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27651 __pyx_t_float_complex
z;
27652 z.real = a.real - b.real;
27653 z.imag = a.imag - b.imag;
27656 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27657 __pyx_t_float_complex
z;
27658 z.real = a.real * b.real - a.imag * b.imag;
27659 z.imag = a.real * b.imag + a.imag * b.real;
27663 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27665 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27666 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
27667 if (b.real == 0 && b.imag == 0) {
27668 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
27670 float r = b.imag / b.real;
27671 float s = (float)(1.0) / (b.real + b.imag *
r);
27672 return __pyx_t_float_complex_from_parts(
27673 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27676 float r = b.real / b.imag;
27677 float s = (float)(1.0) / (b.imag + b.real *
r);
27678 return __pyx_t_float_complex_from_parts(
27679 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27683 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27685 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27687 float denom = b.real * b.real + b.imag * b.imag;
27688 return __pyx_t_float_complex_from_parts(
27689 (a.real * b.real + a.imag * b.imag) / denom,
27690 (a.imag * b.real - a.real * b.imag) / denom);
27694 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
27695 __pyx_t_float_complex
z;
27700 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
27701 return (a.real == 0) && (a.imag == 0);
27703 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
27704 __pyx_t_float_complex
z;
27710 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
27711 #if !defined(HAVE_HYPOT) || defined(_MSC_VER) 27712 return sqrtf(z.real*z.real + z.imag*z.imag);
27714 return hypotf(z.real, z.imag);
27717 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27718 __pyx_t_float_complex
z;
27719 float r, lnr, theta, z_r, z_theta;
27720 if (b.imag == 0 && b.real == (
int)b.real) {
27722 float denom = a.real * a.real + a.imag * a.imag;
27723 a.real = a.real / denom;
27724 a.imag = -a.imag / denom;
27727 switch ((
int)b.real) {
27735 return __Pyx_c_prod_float(a, a);
27737 z = __Pyx_c_prod_float(a, a);
27738 return __Pyx_c_prod_float(z, a);
27740 z = __Pyx_c_prod_float(a, a);
27741 return __Pyx_c_prod_float(z, z);
27747 }
else if (b.imag == 0) {
27748 z.real = powf(a.real, b.real);
27751 }
else if (a.real > 0) {
27756 theta = atan2f(0.0, -1.0);
27759 r = __Pyx_c_abs_float(a);
27760 theta = atan2f(a.imag, a.real);
27763 z_r = expf(lnr * b.real - theta * b.imag);
27764 z_theta = theta * b.real + lnr * b.imag;
27765 z.real = z_r * cosf(z_theta);
27766 z.imag = z_r * sinf(z_theta);
27773 #if CYTHON_CCOMPLEX 27775 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27776 return ::std::complex< double >(x, y);
27779 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27780 return x + y*(__pyx_t_double_complex)_Complex_I;
27784 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27785 __pyx_t_double_complex
z;
27793 #if CYTHON_CCOMPLEX 27795 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27796 return (a.real == b.real) && (a.imag == b.imag);
27798 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27799 __pyx_t_double_complex
z;
27800 z.real = a.real + b.real;
27801 z.imag = a.imag + b.imag;
27804 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27805 __pyx_t_double_complex
z;
27806 z.real = a.real - b.real;
27807 z.imag = a.imag - b.imag;
27810 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27811 __pyx_t_double_complex
z;
27812 z.real = a.real * b.real - a.imag * b.imag;
27813 z.imag = a.real * b.imag + a.imag * b.real;
27817 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27819 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27820 }
else if (fabs(b.real) >= fabs(b.imag)) {
27821 if (b.real == 0 && b.imag == 0) {
27822 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
27824 double r = b.imag / b.real;
27825 double s = (double)(1.0) / (b.real + b.imag *
r);
27826 return __pyx_t_double_complex_from_parts(
27827 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27830 double r = b.real / b.imag;
27831 double s = (double)(1.0) / (b.imag + b.real *
r);
27832 return __pyx_t_double_complex_from_parts(
27833 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27837 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27839 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27841 double denom = b.real * b.real + b.imag * b.imag;
27842 return __pyx_t_double_complex_from_parts(
27843 (a.real * b.real + a.imag * b.imag) / denom,
27844 (a.imag * b.real - a.real * b.imag) / denom);
27848 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
27849 __pyx_t_double_complex
z;
27854 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
27855 return (a.real == 0) && (a.imag == 0);
27857 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
27858 __pyx_t_double_complex
z;
27864 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
27865 #if !defined(HAVE_HYPOT) || defined(_MSC_VER) 27866 return sqrt(z.real*z.real + z.imag*z.imag);
27868 return hypot(z.real, z.imag);
27871 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27872 __pyx_t_double_complex
z;
27873 double r, lnr, theta, z_r, z_theta;
27874 if (b.imag == 0 && b.real == (
int)b.real) {
27876 double denom = a.real * a.real + a.imag * a.imag;
27877 a.real = a.real / denom;
27878 a.imag = -a.imag / denom;
27881 switch ((
int)b.real) {
27889 return __Pyx_c_prod_double(a, a);
27891 z = __Pyx_c_prod_double(a, a);
27892 return __Pyx_c_prod_double(z, a);
27894 z = __Pyx_c_prod_double(a, a);
27895 return __Pyx_c_prod_double(z, z);
27901 }
else if (b.imag == 0) {
27902 z.real = pow(a.real, b.real);
27905 }
else if (a.real > 0) {
27910 theta = atan2(0.0, -1.0);
27913 r = __Pyx_c_abs_double(a);
27914 theta = atan2(a.imag, a.real);
27917 z_r = exp(lnr * b.real - theta * b.imag);
27918 z_theta = theta * b.real + lnr * b.imag;
27919 z.real = z_r * cos(z_theta);
27920 z.imag = z_r * sin(z_theta);
27927 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(
enum NPY_TYPES value) {
27928 const enum NPY_TYPES neg_one = (
enum NPY_TYPES) ((
enum NPY_TYPES) 0 - (
enum NPY_TYPES) 1), const_zero = (
enum NPY_TYPES) 0;
27929 const int is_unsigned = neg_one > const_zero;
27931 if (
sizeof(
enum NPY_TYPES) <
sizeof(long)) {
27932 return PyInt_FromLong((
long) value);
27933 }
else if (
sizeof(
enum NPY_TYPES) <=
sizeof(
unsigned long)) {
27934 return PyLong_FromUnsignedLong((
unsigned long) value);
27935 #ifdef HAVE_LONG_LONG 27936 }
else if (
sizeof(
enum NPY_TYPES) <=
sizeof(
unsigned PY_LONG_LONG)) {
27937 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27941 if (
sizeof(
enum NPY_TYPES) <=
sizeof(
long)) {
27942 return PyInt_FromLong((
long) value);
27943 #ifdef HAVE_LONG_LONG 27944 }
else if (
sizeof(
enum NPY_TYPES) <=
sizeof(PY_LONG_LONG)) {
27945 return PyLong_FromLongLong((PY_LONG_LONG) value);
27950 int one = 1;
int little = (int)*(
unsigned char *)&one;
27951 unsigned char *bytes = (
unsigned char *)&value;
27952 return _PyLong_FromByteArray(bytes,
sizeof(
enum NPY_TYPES),
27953 little, !is_unsigned);
27958 static __Pyx_memviewslice
27959 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
27960 const char *mode,
int ndim,
27961 size_t sizeof_dtype,
int contig_flag,
27962 int dtype_is_object)
27964 __Pyx_RefNannyDeclarations
27966 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
27967 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
27968 Py_buffer *buf = &from_memview->view;
27969 PyObject *shape_tuple = NULL;
27970 PyObject *temp_int = NULL;
27971 struct __pyx_array_obj *array_obj = NULL;
27972 struct __pyx_memoryview_obj *memview_obj = NULL;
27973 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
27974 for (i = 0; i < ndim; i++) {
27975 if (from_mvs->suboffsets[i] >= 0) {
27976 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with " 27977 "indirect dimensions (axis %d)", i);
27981 shape_tuple = PyTuple_New(ndim);
27982 if (unlikely(!shape_tuple)) {
27985 __Pyx_GOTREF(shape_tuple);
27986 for(i = 0; i < ndim; i++) {
27987 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
27988 if(unlikely(!temp_int)) {
27991 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
27995 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
27996 if (unlikely(!array_obj)) {
27999 __Pyx_GOTREF(array_obj);
28000 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
28001 (PyObject *) array_obj, contig_flag,
28003 from_mvs->memview->typeinfo);
28004 if (unlikely(!memview_obj))
28006 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
28008 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
28009 dtype_is_object) < 0))
28013 __Pyx_XDECREF(new_mvs.memview);
28014 new_mvs.memview = NULL;
28015 new_mvs.data = NULL;
28017 __Pyx_XDECREF(shape_tuple);
28018 __Pyx_XDECREF(temp_int);
28019 __Pyx_XDECREF(array_obj);
28020 __Pyx_RefNannyFinishContext();
28025 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
28026 const int neg_one = (int) ((
int) 0 - (int) 1), const_zero = (int) 0;
28027 const int is_unsigned = neg_one > const_zero;
28028 #if PY_MAJOR_VERSION < 3 28029 if (likely(PyInt_Check(x))) {
28030 if (
sizeof(
int) <
sizeof(long)) {
28031 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
28033 long val = PyInt_AS_LONG(x);
28034 if (is_unsigned && unlikely(val < 0)) {
28035 goto raise_neg_overflow;
28041 if (likely(PyLong_Check(x))) {
28043 #if CYTHON_USE_PYLONG_INTERNALS 28044 const digit* digits = ((PyLongObject*)x)->ob_digit;
28045 switch (Py_SIZE(x)) {
28046 case 0:
return (
int) 0;
28047 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
28049 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
28050 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28051 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28052 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
28053 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
28058 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
28059 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28060 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28061 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
28062 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
28067 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
28068 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28069 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28070 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
28071 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
28077 #if CYTHON_COMPILING_IN_CPYTHON 28078 if (unlikely(Py_SIZE(x) < 0)) {
28079 goto raise_neg_overflow;
28083 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28084 if (unlikely(result < 0))
28086 if (unlikely(result == 1))
28087 goto raise_neg_overflow;
28090 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
28091 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
28092 #ifdef HAVE_LONG_LONG 28093 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
28094 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28098 #if CYTHON_USE_PYLONG_INTERNALS 28099 const digit* digits = ((PyLongObject*)x)->ob_digit;
28100 switch (Py_SIZE(x)) {
28101 case 0:
return (
int) 0;
28102 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
28103 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
28105 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
28106 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28107 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28108 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
28109 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
28114 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
28115 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28116 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28117 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
28118 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
28123 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
28124 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28125 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28126 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
28127 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28132 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
28133 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28134 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28135 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
28136 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28141 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
28142 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28143 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28144 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
28145 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
28150 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
28151 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28152 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28153 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
28154 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
28160 if (
sizeof(
int) <=
sizeof(long)) {
28161 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
28162 #ifdef HAVE_LONG_LONG 28163 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
28164 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
28169 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 28170 PyErr_SetString(PyExc_RuntimeError,
28171 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28174 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28175 #if PY_MAJOR_VERSION < 3 28176 if (likely(v) && !PyLong_Check(v)) {
28178 v = PyNumber_Long(tmp);
28183 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28184 unsigned char *bytes = (
unsigned char *)&val;
28185 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28186 bytes,
sizeof(val),
28187 is_little, !is_unsigned);
28197 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28198 if (!tmp)
return (
int) -1;
28199 val = __Pyx_PyInt_As_int(tmp);
28204 PyErr_SetString(PyExc_OverflowError,
28205 "value too large to convert to int");
28207 raise_neg_overflow:
28208 PyErr_SetString(PyExc_OverflowError,
28209 "can't convert negative value to int");
28214 static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) {
28215 const npy_int32 neg_one = (npy_int32) ((npy_int32) 0 - (npy_int32) 1), const_zero = (npy_int32) 0;
28216 const int is_unsigned = neg_one > const_zero;
28217 #if PY_MAJOR_VERSION < 3 28218 if (likely(PyInt_Check(x))) {
28219 if (
sizeof(npy_int32) <
sizeof(long)) {
28220 __PYX_VERIFY_RETURN_INT(npy_int32,
long, PyInt_AS_LONG(x))
28222 long val = PyInt_AS_LONG(x);
28223 if (is_unsigned && unlikely(val < 0)) {
28224 goto raise_neg_overflow;
28226 return (npy_int32) val;
28230 if (likely(PyLong_Check(x))) {
28232 #if CYTHON_USE_PYLONG_INTERNALS 28233 const digit* digits = ((PyLongObject*)x)->ob_digit;
28234 switch (Py_SIZE(x)) {
28235 case 0:
return (npy_int32) 0;
28236 case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, digits[0])
28238 if (8 *
sizeof(npy_int32) > 1 * PyLong_SHIFT) {
28239 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28240 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28241 }
else if (8 *
sizeof(npy_int32) >= 2 * PyLong_SHIFT) {
28242 return (npy_int32) (((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
28247 if (8 *
sizeof(npy_int32) > 2 * PyLong_SHIFT) {
28248 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28249 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28250 }
else if (8 *
sizeof(npy_int32) >= 3 * PyLong_SHIFT) {
28251 return (npy_int32) (((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
28256 if (8 *
sizeof(npy_int32) > 3 * PyLong_SHIFT) {
28257 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28258 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28259 }
else if (8 *
sizeof(npy_int32) >= 4 * PyLong_SHIFT) {
28260 return (npy_int32) (((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0]));
28266 #if CYTHON_COMPILING_IN_CPYTHON 28267 if (unlikely(Py_SIZE(x) < 0)) {
28268 goto raise_neg_overflow;
28272 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28273 if (unlikely(result < 0))
28274 return (npy_int32) -1;
28275 if (unlikely(result == 1))
28276 goto raise_neg_overflow;
28279 if (
sizeof(npy_int32) <=
sizeof(
unsigned long)) {
28280 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
unsigned long, PyLong_AsUnsignedLong(x))
28281 #ifdef HAVE_LONG_LONG 28282 }
else if (
sizeof(npy_int32) <=
sizeof(
unsigned PY_LONG_LONG)) {
28283 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28287 #if CYTHON_USE_PYLONG_INTERNALS 28288 const digit* digits = ((PyLongObject*)x)->ob_digit;
28289 switch (Py_SIZE(x)) {
28290 case 0:
return (npy_int32) 0;
28291 case -1: __PYX_VERIFY_RETURN_INT(npy_int32, sdigit, (sdigit) (-(sdigit)digits[0]))
28292 case 1: __PYX_VERIFY_RETURN_INT(npy_int32, digit, +digits[0])
28294 if (8 *
sizeof(npy_int32) - 1 > 1 * PyLong_SHIFT) {
28295 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28296 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28297 }
else if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
28298 return (npy_int32) (((npy_int32)-1)*(((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
28303 if (8 *
sizeof(npy_int32) > 1 * PyLong_SHIFT) {
28304 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28305 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28306 }
else if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
28307 return (npy_int32) ((((((npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
28312 if (8 *
sizeof(npy_int32) - 1 > 2 * PyLong_SHIFT) {
28313 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28314 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28315 }
else if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
28316 return (npy_int32) (((npy_int32)-1)*(((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
28321 if (8 *
sizeof(npy_int32) > 2 * PyLong_SHIFT) {
28322 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28323 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28324 }
else if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
28325 return (npy_int32) ((((((((npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
28330 if (8 *
sizeof(npy_int32) - 1 > 3 * PyLong_SHIFT) {
28331 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28332 __PYX_VERIFY_RETURN_INT(npy_int32,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28333 }
else if (8 *
sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
28334 return (npy_int32) (((npy_int32)-1)*(((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
28339 if (8 *
sizeof(npy_int32) > 3 * PyLong_SHIFT) {
28340 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28341 __PYX_VERIFY_RETURN_INT(npy_int32,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28342 }
else if (8 *
sizeof(npy_int32) - 1 > 4 * PyLong_SHIFT) {
28343 return (npy_int32) ((((((((((npy_int32)digits[3]) << PyLong_SHIFT) | (npy_int32)digits[2]) << PyLong_SHIFT) | (npy_int32)digits[1]) << PyLong_SHIFT) | (npy_int32)digits[0])));
28349 if (
sizeof(npy_int32) <=
sizeof(long)) {
28350 __PYX_VERIFY_RETURN_INT_EXC(npy_int32,
long, PyLong_AsLong(x))
28351 #ifdef HAVE_LONG_LONG 28352 }
else if (
sizeof(npy_int32) <=
sizeof(PY_LONG_LONG)) {
28353 __PYX_VERIFY_RETURN_INT_EXC(npy_int32, PY_LONG_LONG, PyLong_AsLongLong(x))
28358 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 28359 PyErr_SetString(PyExc_RuntimeError,
28360 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28363 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28364 #if PY_MAJOR_VERSION < 3 28365 if (likely(v) && !PyLong_Check(v)) {
28367 v = PyNumber_Long(tmp);
28372 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28373 unsigned char *bytes = (
unsigned char *)&val;
28374 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28375 bytes,
sizeof(val),
28376 is_little, !is_unsigned);
28382 return (npy_int32) -1;
28386 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28387 if (!tmp)
return (npy_int32) -1;
28388 val = __Pyx_PyInt_As_npy_int32(tmp);
28393 PyErr_SetString(PyExc_OverflowError,
28394 "value too large to convert to npy_int32");
28395 return (npy_int32) -1;
28396 raise_neg_overflow:
28397 PyErr_SetString(PyExc_OverflowError,
28398 "can't convert negative value to npy_int32");
28399 return (npy_int32) -1;
28403 static CYTHON_INLINE
size_t __Pyx_PyInt_As_size_t(PyObject *x) {
28404 const size_t neg_one = (size_t) ((
size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
28405 const int is_unsigned = neg_one > const_zero;
28406 #if PY_MAJOR_VERSION < 3 28407 if (likely(PyInt_Check(x))) {
28408 if (
sizeof(
size_t) <
sizeof(long)) {
28409 __PYX_VERIFY_RETURN_INT(
size_t,
long, PyInt_AS_LONG(x))
28411 long val = PyInt_AS_LONG(x);
28412 if (is_unsigned && unlikely(val < 0)) {
28413 goto raise_neg_overflow;
28415 return (
size_t) val;
28419 if (likely(PyLong_Check(x))) {
28421 #if CYTHON_USE_PYLONG_INTERNALS 28422 const digit* digits = ((PyLongObject*)x)->ob_digit;
28423 switch (Py_SIZE(x)) {
28424 case 0:
return (
size_t) 0;
28425 case 1: __PYX_VERIFY_RETURN_INT(
size_t, digit, digits[0])
28427 if (8 *
sizeof(
size_t) > 1 * PyLong_SHIFT) {
28428 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28429 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28430 }
else if (8 *
sizeof(
size_t) >= 2 * PyLong_SHIFT) {
28431 return (
size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28436 if (8 *
sizeof(
size_t) > 2 * PyLong_SHIFT) {
28437 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28438 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28439 }
else if (8 *
sizeof(
size_t) >= 3 * PyLong_SHIFT) {
28440 return (
size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28445 if (8 *
sizeof(
size_t) > 3 * PyLong_SHIFT) {
28446 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28447 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28448 }
else if (8 *
sizeof(
size_t) >= 4 * PyLong_SHIFT) {
28449 return (
size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28455 #if CYTHON_COMPILING_IN_CPYTHON 28456 if (unlikely(Py_SIZE(x) < 0)) {
28457 goto raise_neg_overflow;
28461 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28462 if (unlikely(result < 0))
28463 return (
size_t) -1;
28464 if (unlikely(result == 1))
28465 goto raise_neg_overflow;
28468 if (
sizeof(
size_t) <=
sizeof(
unsigned long)) {
28469 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
unsigned long, PyLong_AsUnsignedLong(x))
28470 #ifdef HAVE_LONG_LONG 28471 }
else if (
sizeof(
size_t) <=
sizeof(
unsigned PY_LONG_LONG)) {
28472 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28476 #if CYTHON_USE_PYLONG_INTERNALS 28477 const digit* digits = ((PyLongObject*)x)->ob_digit;
28478 switch (Py_SIZE(x)) {
28479 case 0:
return (
size_t) 0;
28480 case -1: __PYX_VERIFY_RETURN_INT(
size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
28481 case 1: __PYX_VERIFY_RETURN_INT(
size_t, digit, +digits[0])
28483 if (8 *
sizeof(
size_t) - 1 > 1 * PyLong_SHIFT) {
28484 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28485 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28486 }
else if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
28487 return (
size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
28492 if (8 *
sizeof(
size_t) > 1 * PyLong_SHIFT) {
28493 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28494 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28495 }
else if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
28496 return (
size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
28501 if (8 *
sizeof(
size_t) - 1 > 2 * PyLong_SHIFT) {
28502 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28503 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28504 }
else if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
28505 return (
size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
28510 if (8 *
sizeof(
size_t) > 2 * PyLong_SHIFT) {
28511 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28512 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28513 }
else if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
28514 return (
size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
28519 if (8 *
sizeof(
size_t) - 1 > 3 * PyLong_SHIFT) {
28520 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28521 __PYX_VERIFY_RETURN_INT(
size_t,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28522 }
else if (8 *
sizeof(
size_t) - 1 > 4 * PyLong_SHIFT) {
28523 return (
size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
28528 if (8 *
sizeof(
size_t) > 3 * PyLong_SHIFT) {
28529 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28530 __PYX_VERIFY_RETURN_INT(
size_t,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28531 }
else if (8 *
sizeof(
size_t) - 1 > 4 * PyLong_SHIFT) {
28532 return (
size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0])));
28538 if (
sizeof(
size_t) <=
sizeof(long)) {
28539 __PYX_VERIFY_RETURN_INT_EXC(
size_t,
long, PyLong_AsLong(x))
28540 #ifdef HAVE_LONG_LONG 28541 }
else if (
sizeof(
size_t) <=
sizeof(PY_LONG_LONG)) {
28542 __PYX_VERIFY_RETURN_INT_EXC(
size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
28547 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 28548 PyErr_SetString(PyExc_RuntimeError,
28549 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28552 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28553 #if PY_MAJOR_VERSION < 3 28554 if (likely(v) && !PyLong_Check(v)) {
28556 v = PyNumber_Long(tmp);
28561 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28562 unsigned char *bytes = (
unsigned char *)&val;
28563 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28564 bytes,
sizeof(val),
28565 is_little, !is_unsigned);
28571 return (
size_t) -1;
28575 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28576 if (!tmp)
return (
size_t) -1;
28577 val = __Pyx_PyInt_As_size_t(tmp);
28582 PyErr_SetString(PyExc_OverflowError,
28583 "value too large to convert to size_t");
28584 return (
size_t) -1;
28585 raise_neg_overflow:
28586 PyErr_SetString(PyExc_OverflowError,
28587 "can't convert negative value to size_t");
28588 return (
size_t) -1;
28592 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
28593 const long neg_one = (long) ((
long) 0 - (long) 1), const_zero = (long) 0;
28594 const int is_unsigned = neg_one > const_zero;
28595 #if PY_MAJOR_VERSION < 3 28596 if (likely(PyInt_Check(x))) {
28597 if (
sizeof(
long) <
sizeof(long)) {
28598 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
28600 long val = PyInt_AS_LONG(x);
28601 if (is_unsigned && unlikely(val < 0)) {
28602 goto raise_neg_overflow;
28608 if (likely(PyLong_Check(x))) {
28610 #if CYTHON_USE_PYLONG_INTERNALS 28611 const digit* digits = ((PyLongObject*)x)->ob_digit;
28612 switch (Py_SIZE(x)) {
28613 case 0:
return (
long) 0;
28614 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
28616 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
28617 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28618 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28619 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
28620 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
28625 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
28626 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28627 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28628 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
28629 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28634 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
28635 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28636 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28637 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
28638 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
28644 #if CYTHON_COMPILING_IN_CPYTHON 28645 if (unlikely(Py_SIZE(x) < 0)) {
28646 goto raise_neg_overflow;
28650 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28651 if (unlikely(result < 0))
28653 if (unlikely(result == 1))
28654 goto raise_neg_overflow;
28657 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
28658 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
28659 #ifdef HAVE_LONG_LONG 28660 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
28661 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28665 #if CYTHON_USE_PYLONG_INTERNALS 28666 const digit* digits = ((PyLongObject*)x)->ob_digit;
28667 switch (Py_SIZE(x)) {
28668 case 0:
return (
long) 0;
28669 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
28670 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
28672 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
28673 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28674 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28675 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28676 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28681 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
28682 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28683 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28684 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28685 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28690 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28691 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28692 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28693 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28694 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28699 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
28700 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28701 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28702 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28703 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28708 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28709 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28710 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28711 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28712 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28717 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
28718 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28719 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28720 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28721 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28727 if (
sizeof(
long) <=
sizeof(long)) {
28728 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
28729 #ifdef HAVE_LONG_LONG 28730 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
28731 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
28736 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 28737 PyErr_SetString(PyExc_RuntimeError,
28738 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28741 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28742 #if PY_MAJOR_VERSION < 3 28743 if (likely(v) && !PyLong_Check(v)) {
28745 v = PyNumber_Long(tmp);
28750 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28751 unsigned char *bytes = (
unsigned char *)&val;
28752 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28753 bytes,
sizeof(val),
28754 is_little, !is_unsigned);
28764 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28765 if (!tmp)
return (
long) -1;
28766 val = __Pyx_PyInt_As_long(tmp);
28771 PyErr_SetString(PyExc_OverflowError,
28772 "value too large to convert to long");
28774 raise_neg_overflow:
28775 PyErr_SetString(PyExc_OverflowError,
28776 "can't convert negative value to long");
28781 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
28782 const long neg_one = (long) ((
long) 0 - (long) 1), const_zero = (long) 0;
28783 const int is_unsigned = neg_one > const_zero;
28785 if (
sizeof(
long) <
sizeof(long)) {
28786 return PyInt_FromLong((
long) value);
28787 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
28788 return PyLong_FromUnsignedLong((
unsigned long) value);
28789 #ifdef HAVE_LONG_LONG 28790 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
28791 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
28795 if (
sizeof(
long) <=
sizeof(
long)) {
28796 return PyInt_FromLong((
long) value);
28797 #ifdef HAVE_LONG_LONG 28798 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
28799 return PyLong_FromLongLong((PY_LONG_LONG) value);
28804 int one = 1;
int little = (int)*(
unsigned char *)&one;
28805 unsigned char *bytes = (
unsigned char *)&value;
28806 return _PyLong_FromByteArray(bytes,
sizeof(
long),
28807 little, !is_unsigned);
28812 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
28813 const char neg_one = (char) ((
char) 0 - (char) 1), const_zero = (char) 0;
28814 const int is_unsigned = neg_one > const_zero;
28815 #if PY_MAJOR_VERSION < 3 28816 if (likely(PyInt_Check(x))) {
28817 if (
sizeof(
char) <
sizeof(long)) {
28818 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
28820 long val = PyInt_AS_LONG(x);
28821 if (is_unsigned && unlikely(val < 0)) {
28822 goto raise_neg_overflow;
28828 if (likely(PyLong_Check(x))) {
28830 #if CYTHON_USE_PYLONG_INTERNALS 28831 const digit* digits = ((PyLongObject*)x)->ob_digit;
28832 switch (Py_SIZE(x)) {
28833 case 0:
return (
char) 0;
28834 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
28836 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
28837 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28838 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28839 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
28840 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
28845 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
28846 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28847 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28848 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
28849 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
28854 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
28855 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28856 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28857 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
28858 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
28864 #if CYTHON_COMPILING_IN_CPYTHON 28865 if (unlikely(Py_SIZE(x) < 0)) {
28866 goto raise_neg_overflow;
28870 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28871 if (unlikely(result < 0))
28873 if (unlikely(result == 1))
28874 goto raise_neg_overflow;
28877 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
28878 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
28879 #ifdef HAVE_LONG_LONG 28880 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
28881 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28885 #if CYTHON_USE_PYLONG_INTERNALS 28886 const digit* digits = ((PyLongObject*)x)->ob_digit;
28887 switch (Py_SIZE(x)) {
28888 case 0:
return (
char) 0;
28889 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
28890 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
28892 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
28893 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28894 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28895 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28896 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28901 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
28902 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28903 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28904 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28905 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28910 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28911 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28912 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28913 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28914 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
28919 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
28920 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28921 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28922 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28923 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
28928 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28929 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28930 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28931 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
28932 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28937 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
28938 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28939 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28940 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
28941 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28947 if (
sizeof(
char) <=
sizeof(long)) {
28948 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
28949 #ifdef HAVE_LONG_LONG 28950 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
28951 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
28956 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 28957 PyErr_SetString(PyExc_RuntimeError,
28958 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28961 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28962 #if PY_MAJOR_VERSION < 3 28963 if (likely(v) && !PyLong_Check(v)) {
28965 v = PyNumber_Long(tmp);
28970 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28971 unsigned char *bytes = (
unsigned char *)&val;
28972 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28973 bytes,
sizeof(val),
28974 is_little, !is_unsigned);
28984 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28985 if (!tmp)
return (
char) -1;
28986 val = __Pyx_PyInt_As_char(tmp);
28991 PyErr_SetString(PyExc_OverflowError,
28992 "value too large to convert to char");
28994 raise_neg_overflow:
28995 PyErr_SetString(PyExc_OverflowError,
28996 "can't convert negative value to char");
29001 static int __Pyx_check_binary_version(
void) {
29002 char ctversion[4], rtversion[4];
29003 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
29004 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
29005 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
29007 PyOS_snprintf(message,
sizeof(message),
29008 "compiletime version %s of module '%.100s' " 29009 "does not match runtime version %s",
29010 ctversion, __Pyx_MODULE_NAME, rtversion);
29011 return PyErr_WarnEx(NULL, message, 1);
29017 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
29019 #if PY_MAJOR_VERSION < 3 29020 if (t->is_unicode) {
29021 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
29022 }
else if (t->intern) {
29023 *t->p = PyString_InternFromString(t->s);
29025 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
29028 if (t->is_unicode | t->is_str) {
29030 *t->p = PyUnicode_InternFromString(t->s);
29031 }
else if (t->encoding) {
29032 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
29034 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
29037 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
29042 if (PyObject_Hash(*t->p) == -1)
29049 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
29050 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
29052 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
29054 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
29056 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 29057 #if !CYTHON_PEP393_ENABLED 29058 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29060 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
29061 if (!defenc)
return NULL;
29062 defenc_c = PyBytes_AS_STRING(defenc);
29063 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 29065 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
29067 for (c = defenc_c; c < end; c++) {
29068 if ((
unsigned char) (*c) >= 128) {
29069 PyUnicode_AsASCIIString(o);
29075 *length = PyBytes_GET_SIZE(defenc);
29079 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29080 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
29081 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 29082 if (likely(PyUnicode_IS_ASCII(o))) {
29083 *length = PyUnicode_GET_LENGTH(o);
29084 return PyUnicode_AsUTF8(o);
29086 PyUnicode_AsASCIIString(o);
29090 return PyUnicode_AsUTF8AndSize(o, length);
29095 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29096 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 29098 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29099 __Pyx_sys_getdefaultencoding_not_ascii &&
29101 PyUnicode_Check(o)) {
29102 return __Pyx_PyUnicode_AsStringAndSize(o, length);
29105 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) 29106 if (PyByteArray_Check(o)) {
29107 *length = PyByteArray_GET_SIZE(o);
29108 return PyByteArray_AS_STRING(o);
29113 int r = PyBytes_AsStringAndSize(o, &result, length);
29114 if (unlikely(r < 0)) {
29121 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
29122 int is_true = x == Py_True;
29123 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
29124 else return PyObject_IsTrue(x);
29126 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
29128 if (unlikely(!x))
return -1;
29129 retval = __Pyx_PyObject_IsTrue(x);
29133 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
29134 #if PY_MAJOR_VERSION >= 3 29135 if (PyLong_Check(result)) {
29136 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
29137 "__int__ returned non-int (type %.200s). " 29138 "The ability to return an instance of a strict subclass of int " 29139 "is deprecated, and may be removed in a future version of Python.",
29140 Py_TYPE(result)->tp_name)) {
29147 PyErr_Format(PyExc_TypeError,
29148 "__%.4s__ returned non-%.4s (type %.200s)",
29149 type_name, type_name, Py_TYPE(result)->tp_name);
29153 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
29154 #if CYTHON_USE_TYPE_SLOTS 29155 PyNumberMethods *m;
29157 const char *name = NULL;
29158 PyObject *res = NULL;
29159 #if PY_MAJOR_VERSION < 3 29160 if (likely(PyInt_Check(x) || PyLong_Check(x)))
29162 if (likely(PyLong_Check(x)))
29164 return __Pyx_NewRef(x);
29165 #if CYTHON_USE_TYPE_SLOTS 29166 m = Py_TYPE(x)->tp_as_number;
29167 #if PY_MAJOR_VERSION < 3 29168 if (m && m->nb_int) {
29170 res = m->nb_int(x);
29172 else if (m && m->nb_long) {
29174 res = m->nb_long(x);
29177 if (likely(m && m->nb_int)) {
29179 res = m->nb_int(x);
29183 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
29184 res = PyNumber_Int(x);
29188 #if PY_MAJOR_VERSION < 3 29189 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
29191 if (unlikely(!PyLong_CheckExact(res))) {
29193 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
29196 else if (!PyErr_Occurred()) {
29197 PyErr_SetString(PyExc_TypeError,
29198 "an integer is required");
29202 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
29205 #if PY_MAJOR_VERSION < 3 29206 if (likely(PyInt_CheckExact(b))) {
29207 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
29208 return PyInt_AS_LONG(b);
29210 return PyInt_AsSsize_t(b);
29213 if (likely(PyLong_CheckExact(b))) {
29214 #if CYTHON_USE_PYLONG_INTERNALS 29215 const digit* digits = ((PyLongObject*)b)->ob_digit;
29216 const Py_ssize_t size = Py_SIZE(b);
29217 if (likely(__Pyx_sst_abs(size) <= 1)) {
29218 ival = likely(size) ? digits[0] : 0;
29219 if (size == -1) ival = -ival;
29224 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
29225 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
29229 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
29230 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29234 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
29235 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29239 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
29240 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
29244 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
29245 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
29249 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
29250 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29256 return PyLong_AsSsize_t(b);
29258 x = PyNumber_Index(b);
29260 ival = PyInt_AsSsize_t(x);
29264 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
29265 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
29267 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
29268 return PyInt_FromSize_t(ival);